diff --git a/packages/python/e2e-attestations/bot-1471-one-level-restore-1102.json b/packages/python/e2e-attestations/bot-1471-one-level-restore-1102.json new file mode 100644 index 00000000..18b77711 --- /dev/null +++ b/packages/python/e2e-attestations/bot-1471-one-level-restore-1102.json @@ -0,0 +1,7 @@ +{ + "command": "uv run python -m pytest tests/e2e/glob_speed_one_level_test.py -x -q -s", + "ran_at": 1793673449, + "exit_code": 0, + "commit": "d2f907e7dae672c3c7bfc86399cddf43bf404795", + "branch": "bot/1471-one-level-restore-1102" +} diff --git a/packages/python/tests/e2e/glob_speed_one_level_test.py b/packages/python/tests/e2e/glob_speed_one_level_test.py index 40a5fb0a..3770c1a6 100644 --- a/packages/python/tests/e2e/glob_speed_one_level_test.py +++ b/packages/python/tests/e2e/glob_speed_one_level_test.py @@ -1,4 +1,4 @@ -"""Glob speed: one-level listings, `'./*'`. +"""Glob speed: one-level listings, `'./*'`, `'./'` and `'./docs'`. A wide flat root and a wide flat `docs/`, each beside subdirectories full of files that a one-level listing must not read, plus dotfiles it must hide. @@ -15,6 +15,7 @@ import pytest from .speed_of_light import ( + FASTEST, Native, agreed_rows, assert_speed_of_light, @@ -44,6 +45,20 @@ '{bin} -c \'for f in *; do if [ -f "$f" ]; then printf "%s\\n" "$f"; fi; done\'', ), ] +DOCS_NATIVE = [ + Native( + "find", + ("find",), + "{bin} docs -mindepth 1 -maxdepth 1 -type f ! -name '.*'", + ), + fd("--max-depth 1 . docs"), + rg("--max-depth 1 docs"), + Native( + "bash-glob", + ("bash",), + '{bin} -c \'for f in docs/*; do if [ -f "$f" ]; then printf "%s\\n" "$f"; fi; done\'', + ), +] FILES_PER_SUBDIR = 1000 @@ -76,10 +91,14 @@ def tree(tmp_path_factory): shutil.rmtree(root, ignore_errors=True) @pytest.mark.parametrize( - ("glob", "specs"), - [("./*", ROOT_NATIVE)], + ("glob", "specs", "bar"), + [ + ("./*", ROOT_NATIVE, ""), + ("./", ROOT_NATIVE, FASTEST), + ("./docs", DOCS_NATIVE, FASTEST), + ], ) - def it_matches_native_files_within_the_bar(tree, glob, specs): + def it_matches_native_files_within_the_bar(tree, glob, specs, bar): root, n, startup = tree def dirsql(timeout): @@ -90,7 +109,7 @@ def dirsql(timeout): ) return sorted(row for (row,) in dirsql_rows(proc, ("path",))), seconds - result = paired(shell_natives(root, specs), dirsql, startup) + result = paired(shell_natives(root, specs, bar=bar), dirsql, startup) expected, actual = agreed_rows(result), result.dirsql_rows assert len(expected) == n - len(range(0, n, 50))