Skip to content

Commit 2c901d4

Browse files
authored
use shorter testcase ids for paths (#830)
* use shorter testcase ids for paths * Rename test_url_open_remote[https---webknossos.org-datasets-scalable_minds-l4_sample_dev_sharing-view-token=ilDXmfQa2G8e719vb1U9YQ#-7B-22orthogonal-7D].yaml to test_url_open_remote[l4_sample_dev_sharing-view].yaml * Rename test_url_download[https---webknossos.org-datasets-scalable_minds-l4_sample_dev_sharing-view-token=ilDXmfQa2G8e719vb1U9YQ#-7B-22orthogonal-7D].yaml to test_url_download[l4_sample_dev_sharing-view].yaml * rm locally
1 parent f943f40 commit 2c901d4

7 files changed

+16
-0
lines changed

webknossos/tests/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121

2222
from .constants import TESTDATA_DIR, TESTOUTPUT_DIR
2323

24+
25+
def pytest_make_parametrize_id(config: Any, val: Any, argname: str) -> Any:
26+
del config
27+
del argname
28+
if isinstance(val, str):
29+
val = val.rsplit("?", maxsplit=1)[0]
30+
val = val.rsplit("#", maxsplit=1)[0]
31+
parts = val.rstrip("/").split("/")
32+
take = 1
33+
while (len(parts[-take]) <= 1 or parts[-take] == "view") and take < len(parts):
34+
take += 1
35+
return "/".join(parts[-take:])
36+
# return None to let pytest handle the formatting
37+
return None
38+
39+
2440
### HYPOTHESIS STRATEGIES (library to test many combinations for data class input)
2541

2642

0 commit comments

Comments
 (0)