Skip to content

Commit c00b962

Browse files
committed
1 parent 0fc6f9c commit c00b962

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_functional.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ def test_filter_fnmatch_pattern(tmp_path: Path, capsys: CaptureFixture[str], run
161161
write_config(tmp_path, runner, pattern="'**/*.rst'")
162162
results = run(capsys, runner, tmp_path)
163163
# The fact that the two .rst files in the root aren't matched is
164-
# arguably a bug in the Python interpretation of **/
164+
# arguably a bug in the Python interpretation of **/ in Python < 3.13
165+
expected_total = 4
165166
results.out.assert_has_run(runner, '/parent/foo.rst')
166167
results.out.assert_has_run(runner, '/parent/bar.rst')
167168
results.out.assert_has_run(runner, '/parent/child/foo.rst')
168169
results.out.assert_has_run(runner, '/parent/child/bar.rst')
169-
assert results.total == 4, results.out.text
170+
# The interpretation of **/ was fixed in Python 3.13
171+
if sys.version_info >= (3, 13):
172+
expected_total = 6
173+
results.out.assert_has_run(runner, '/foo.rst')
174+
results.out.assert_has_run(runner, '/bar.rst')
175+
assert results.total == expected_total, results.out.text
170176

171177

172178
@pytest.mark.parametrize('runner', [PYTEST, UNITTEST])
@@ -211,10 +217,11 @@ def test_filter_directory_with_excludes(tmp_path: Path, capsys: CaptureFixture[s
211217
@pytest.mark.parametrize('runner', [PYTEST, UNITTEST])
212218
def test_filter_filenames_and_excludes(tmp_path: Path, capsys: CaptureFixture[str], runner: str):
213219
make_tree(tmp_path)
220+
globber = "**/" if sys.version_info >= (3, 13) else "**"
214221
write_config(tmp_path, runner,
215222
path=f"'{tmp_path / 'parent'}'",
216223
filenames="{'bar.rst'}",
217-
excludes="['**child/*.rst']")
224+
excludes=f"['{globber}child/*.rst']")
218225
results = run(capsys, runner, tmp_path)
219226
results.out.assert_has_run(runner, '/parent/bar.rst')
220227
assert results.total == 1, results.out.text

0 commit comments

Comments
 (0)