Skip to content

Commit fcee56d

Browse files
Merge pull request #1591 from LOCEANlloydizard/fix_numpy_update_2.4
Update test_commongrid_api.py to match numpy update 2.4 and add prints to confest.py to display more info
2 parents 822bc84 + 8505ec9 commit fcee56d

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

echopype/tests/commongrid/test_commongrid_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,10 @@ def test_compute_MVBS_range_output(request, er_type):
332332
ds_MVBS = ep.commongrid.compute_MVBS(ds_Sv, range_bin="5m", ping_time_bin="10s")
333333

334334
if er_type == "regular":
335+
dt_ns = np.diff(ds_Sv["ping_time"][[0, -1]].values)[0]
335336
expected_len = (
336337
ds_Sv["channel"].size, # channel
337-
int(np.ceil(int(np.diff(ds_Sv["ping_time"][[0, -1]])) / 1e9 / 10)), # ping_time
338+
int(np.ceil(int(dt_ns) / 1e9 / 10)), # ping_time
338339
int(np.ceil(ds_Sv["echo_range"].max() / 5)), # depth
339340
)
340341
assert ds_MVBS["Sv"].shape == expected_len

echopype/tests/conftest.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
)
1616
cache_dir = pooch.os_cache("echopype")
1717

18+
print(
19+
"\n[echopype-ci] POOCH CONFIG\n"
20+
f" USE_POOCH = {os.getenv('USE_POOCH')}\n"
21+
f" ECHOPYPE_DATA_VERSION = {ver}\n"
22+
f" ECHOPYPE_DATA_BASEURL = {base}\n"
23+
f" pooch cache_dir = {cache_dir}\n",
24+
flush=True,
25+
)
26+
1827
bundles = [
1928
"ad2cp.zip", "azfp.zip", "azfp6.zip", "ea640.zip", "ecs.zip", "ek60.zip",
2029
"ek60_calibrate_chunks.zip", "ek60_missing_channel_power.zip", "ek80.zip",
@@ -60,14 +69,24 @@
6069
def _unpack(fname, action, pooch_instance):
6170
z = Path(fname)
6271
out = z.parent / z.stem
72+
73+
print(
74+
"\n[echopype-ci] UNPACK\n"
75+
f" zip file = {z}\n"
76+
f" action = {action}\n"
77+
f" extract_to = {out}\n",
78+
flush=True,
79+
)
80+
6381
if action in ("update", "download") or not out.exists():
6482
from zipfile import ZipFile
83+
6584
with ZipFile(z, "r") as f:
6685
f.extractall(out)
6786

6887
# flatten single nested dir if needed
6988
try:
70-
entries = [p for p in out.iterdir()]
89+
entries = list(out.iterdir())
7190
if len(entries) == 1 and entries[0].is_dir():
7291
inner = entries[0]
7392
for child in inner.iterdir():
@@ -80,12 +99,42 @@ def _unpack(fname, action, pooch_instance):
8099
pass
81100
except Exception:
82101
pass
102+
103+
# Print tree after extraction/flatten
104+
try:
105+
if out.exists():
106+
print("[echopype-ci] extracted tree (depth ≤ 2):")
107+
for p in sorted(out.glob("*")):
108+
print(f" - {p.name}")
109+
if p.is_dir():
110+
for q in sorted(p.glob("*")):
111+
print(f" • {q.name}")
112+
except Exception:
113+
pass
114+
83115
return str(out)
84116

117+
85118
for b in bundles:
119+
url = base.format(version=ver) + b
120+
print(f"[echopype-ci] fetching bundle: {b}")
121+
print(f"[echopype-ci] → URL: {url}")
86122
EP.fetch(b, processor=_unpack, progressbar=False)
87123

88124
TEST_DATA_FOLDER = Path(cache_dir) / ver
125+
126+
print(
127+
"\n[echopype-ci] TEST_DATA_FOLDER\n"
128+
f" path = {TEST_DATA_FOLDER}\n"
129+
f" exists = {TEST_DATA_FOLDER.exists()}\n",
130+
flush=True,
131+
)
132+
133+
if TEST_DATA_FOLDER.exists():
134+
print("[echopype-ci] top-level contents:")
135+
for p in sorted(TEST_DATA_FOLDER.iterdir()):
136+
print(f" - {p.name}")
137+
89138

90139
@pytest.fixture(scope="session")
91140
def dump_output_dir():

0 commit comments

Comments
 (0)