diff --git a/packages/python/e2e-attestations/bot-1504-bench-names-1011.json b/packages/python/e2e-attestations/bot-1504-bench-names-1011.json new file mode 100644 index 000000000..3b5b48767 --- /dev/null +++ b/packages/python/e2e-attestations/bot-1504-bench-names-1011.json @@ -0,0 +1,7 @@ +{ + "command": "uv run python -m tests.e2e.bench_suite --pairs 3 --out /tmp/bench-1504 -k \"glob_speed_symlink or glob_speed_dotfiles or glob_speed_recursive\"", + "ran_at": 1791770495, + "exit_code": 0, + "commit": "cce3e83ece8026cc8feedbb1cd64f73242f1d230", + "branch": "bot/1504-bench-names-1011" +} diff --git a/packages/python/tests/e2e/glob_speed_dotfiles_test.py b/packages/python/tests/e2e/glob_speed_dotfiles_test.py index 779353e9e..7e76b02dd 100644 --- a/packages/python/tests/e2e/glob_speed_dotfiles_test.py +++ b/packages/python/tests/e2e/glob_speed_dotfiles_test.py @@ -58,6 +58,11 @@ fd("--glob '*.md' .cache"), rg("-g '*.md' -g '!.*' .cache"), ] +CASES = [ + ("./**/*.md (dotfiles)", "./**/*.md", MARKDOWN), + ("./**/.*", "./**/.*", DOTFILES), + ("./.cache/**/*.md", "./.cache/**/*.md", UNDER_CACHE), +] FANOUT = 8 @@ -120,15 +125,8 @@ def tree(tmp_path_factory): finally: shutil.rmtree(root, ignore_errors=True) - @pytest.mark.parametrize( - ("glob", "specs"), - [ - ("./**/*.md", MARKDOWN), - ("./**/.*", DOTFILES), - ("./.cache/**/*.md", UNDER_CACHE), - ], - ) - def it_matches_native_files_within_the_bar(tree, glob, specs): + @pytest.mark.parametrize(("name", "glob", "specs"), CASES) + def it_matches_native_files_within_the_bar(tree, name, glob, specs): root, n, startup = tree def dirsql(timeout): @@ -144,4 +142,4 @@ def dirsql(timeout): assert len(expected) == matched(n, glob) assert actual == expected - assert_speed_of_light(glob, result, startup) + assert_speed_of_light(name, result, startup) diff --git a/packages/python/tests/e2e/glob_speed_recursive_test.py b/packages/python/tests/e2e/glob_speed_recursive_test.py index fdadaac0f..81fb55dfb 100644 --- a/packages/python/tests/e2e/glob_speed_recursive_test.py +++ b/packages/python/tests/e2e/glob_speed_recursive_test.py @@ -52,6 +52,10 @@ rg("-g '*.md' -g '!.*' a/b"), *suite_only(globstar("./a/b/**/*.md")), ] +CASES = [ + ("./**/*.md", "./**/*.md", ALL_NATIVE, ""), + ("./a/b/**/*.md", "./a/b/**/*.md", PREFIX_NATIVE, "a/b"), +] FANOUT = 8 @@ -109,11 +113,8 @@ def tree(tmp_path_factory): finally: shutil.rmtree(root, ignore_errors=True) - @pytest.mark.parametrize( - ("glob", "specs", "prefix"), - [("./**/*.md", ALL_NATIVE, ""), ("./a/b/**/*.md", PREFIX_NATIVE, "a/b")], - ) - def it_matches_native_files_within_the_bar(tree, glob, specs, prefix): + @pytest.mark.parametrize(("name", "glob", "specs", "prefix"), CASES) + def it_matches_native_files_within_the_bar(tree, name, glob, specs, prefix): root, n, startup = tree def dirsql(timeout): @@ -129,4 +130,4 @@ def dirsql(timeout): assert len(expected) == matched(n, prefix) assert actual == expected - assert_speed_of_light(glob, result, startup) + assert_speed_of_light(name, result, startup) diff --git a/packages/python/tests/e2e/glob_speed_symlink_test.py b/packages/python/tests/e2e/glob_speed_symlink_test.py index 991d4cf06..46dc9be0c 100644 --- a/packages/python/tests/e2e/glob_speed_symlink_test.py +++ b/packages/python/tests/e2e/glob_speed_symlink_test.py @@ -49,6 +49,10 @@ '{bin} -c \'for f in docs/*; do if [ -f "$f" ]; then printf "%s\\n" "$f"; fi; done\'', ), ] +CASES = [ + ("./**/*.md (symlinks)", "./**/*.md", LINKED), + ("./docs/", "./docs/", DOCS), +] FANOUT = 8 @@ -109,11 +113,8 @@ def tree(tmp_path_factory): finally: shutil.rmtree(root.parent, ignore_errors=True) - @pytest.mark.parametrize( - ("glob", "specs"), - [("./**/*.md", LINKED), ("./docs/", DOCS)], - ) - def it_matches_native_files_within_the_bar(tree, glob, specs): + @pytest.mark.parametrize(("name", "glob", "specs"), CASES) + def it_matches_native_files_within_the_bar(tree, name, glob, specs): root, n, startup = tree def dirsql(timeout): @@ -129,4 +130,4 @@ def dirsql(timeout): assert len(expected) == matched(n, glob) assert actual == expected - assert_speed_of_light(glob, result, startup) + assert_speed_of_light(name, result, startup) diff --git a/packages/python/tests/integration/hermetic/glob_case_names_test.py b/packages/python/tests/integration/hermetic/glob_case_names_test.py new file mode 100644 index 000000000..44a7f7b1e --- /dev/null +++ b/packages/python/tests/integration/hermetic/glob_case_names_test.py @@ -0,0 +1,24 @@ +"""Hermetic test that the suite's glob cases carry distinct names.""" + +from collections import Counter + +from tests.e2e import ( + glob_speed_dotfiles_test, + glob_speed_recursive_test, + glob_speed_symlink_test, +) + + +def case_names(): + modules = ( + glob_speed_recursive_test, + glob_speed_symlink_test, + glob_speed_dotfiles_test, + ) + return [case[0] for module in modules for case in module.CASES] + + +def describe_glob_case_names(): + def it_gives_every_case_its_own_name(): + repeated = [n for n, count in Counter(case_names()).items() if count > 1] + assert repeated == []