Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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"
}
29 changes: 24 additions & 5 deletions packages/python/tests/e2e/glob_speed_one_level_test.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -15,6 +15,7 @@
import pytest

from .speed_of_light import (
FASTEST,
Native,
agreed_rows,
assert_speed_of_light,
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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):
Expand All @@ -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))

Expand Down
Loading