Added 80 column fix from Sorcha code - #442
Conversation
Added _split_kernel_path_str and its unit test from Sorcha to avoid 80 column bug
|
Nice work, Ryan — tested it end-to-end and it fixes the bug. A long (~165-char) cache path reproduced the One non-blocking note: the unit test checks the split string but never calls import os
import spiceypy
from layup.utilities.bootstrap_utilties.create_meta_kernel import _split_kernel_path_str
def test_meta_kernel_loads_under_long_path(tmp_path):
# A cache path long enough to trip the SPICE 80-char string limit.
deep = tmp_path
while len(str(deep)) < 160:
deep = deep / "12345678"
deep.mkdir(parents=True, exist_ok=True)
# A tiny kernel we can check actually loaded.
(deep / "tiny.tls").write_text(
"\\begindata\nDELTET/DELTA_T_A = 99.5\n\\begintext\n"
)
mk = deep / "meta_kernel.txt"
mk.write_text(
"\\begindata\n\n"
f"PATH_VALUES = ('{_split_kernel_path_str(str(deep))}')\n\n"
"PATH_SYMBOLS = ('A')\n\n"
"KERNELS_TO_LOAD = ( '$A/tiny.tls' )\n\n"
"\\begintext\n"
)
spiceypy.kclear()
try:
spiceypy.furnsh(str(mk)) # would raise TYPEMISMATCH before the fix
assert spiceypy.gdpool("DELTET/DELTA_T_A", 0, 1)[0] == 99.5
finally:
spiceypy.kclear()(Also, docstring says default 79 but it's |
|
No worries. I fixed the docdtring for sorcha but forgot layup oops. Thats a very good point with the unit test, it caused us to miss the bug in Sorcha. I'll add that test to both repos too thank you!! |
Added _split_kernel_path_str and its unit test from Sorcha to avoid 80 column bug
Fixes #433 .
Describe your changes.
Review Checklist for Source Code Changes