diff --git a/bench_runner/result.py b/bench_runner/result.py index b4b3439..3f0e07f 100644 --- a/bench_runner/result.py +++ b/bench_runner/result.py @@ -48,9 +48,9 @@ def _clean(string: str) -> str: """ Clean an arbitrary string to be suitable for a filename. - It can't contain dashes, since dashes are used as a delimiter. + Dashes delimit filename fields, and slashes would create subdirectories. """ - return string.replace("-", "_") + return string.replace("-", "_").replace("/", "_") def _clean_for_url(string: str) -> str: diff --git a/tests/test_result.py b/tests/test_result.py index 23938e3..75e6a3a 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -122,3 +122,11 @@ def gethostname(*args): f"bm-20221119-{platform.system().lower()}-{platform.machine().lower()}" f"-my%2dfork-9d38120e335357a3b294-{platform.python_version()}-b7e4f1d.json" ) + + result = mod_result.Result.from_scratch(python, "my-fork", "jit/free-threading") + assert result.ref == "jit_free_threading" + assert result.filename == Path( + f"results/bm-20221119-{platform.python_version()}-b7e4f1d/" + f"bm-20221119-{platform.system().lower()}-{platform.machine().lower()}" + f"-my%2dfork-jit_free_threading-{platform.python_version()}-b7e4f1d.json" + )