ci/new_test_coverage.py: a glob ending in /, a [...] class and a second pytest after && are read differently from bash and pytest
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start in ci/new_test_coverage.py at the path normalisation (posixpath.normpath, which drops a trailing slash), at glob_re (which reads [ literally), and at pytest_commands and read_command (which stop at &&). Reproduce each row of the three tables with pytest --co under bash in a tree shaped like python/tests/, then compare with what the script reports. Done means each row matches bash and pytest, and a line with two pytest commands has both read.
Written by the indexing model from the issue text.
Description
Three misreadings in ci/new_test_coverage.py, found in the review of the fix for #1874 and not changed by it. Each is checked with pytest 9.2.0 (--co, the command run under bash) in a tree with python/tests/{test_a.py, smoke_test.py, sub/test_x.py, sub/test_w.py, sub/deep/test_d.py, subx/test_y.py}, and with the script on main and with #1874's fix. None of the six workflows that run pytest has any of these shapes. --co with named paths is #1866's item 2 and is left out here.
1. A glob ending in / is read as matching files too
bash expands a glob that ends in / to directories only, but the script's posixpath.normpath drops the slash first.
| command | pytest | the script |
|---|---|---|
python/tests/s*/ python/tests/sub/test_x.py --ignore python/tests/sub/test_x.py |
smoke_test.py is not collected |
reads smoke_test.py as run |
python/tests --deselect python/tests/su?/ |
subx/test_y.py is collected (the prefix is python/tests/sub/) |
reads subx/test_y.py as left out |
The first silences the warning; the second warns where nothing is wrong.
2. A [...] class in a pytest argument is read literally
glob_re reads [ as itself, but bash expands su[b] to sub.
| command | pytest | the script |
|---|---|---|
python/tests/su[b] python/tests/sub/test_x.py --ignore python/tests/sub/test_x.py |
sub/test_x.py is not collected |
reads it as run |
python/tests --deselect python/tests/su[b] |
every test under sub/ (and subx/) is deselected |
reads sub/test_w.py as run |
Both silence the warning. A paths filter that holds [ is already refused before it is matched, so reading bash's classes in glob_re would change only pytest arguments.
3. A second pytest on one line is not read
pytest_commands returns one command per line, and read_command stops at &&, so in run: python -m pytest python/tests/test_a.py && python -m pytest python/tests/test_h1.py the second command is never read: test_h1.py reads as run by no workflow, though pytest runs it. This warns where nothing is wrong. Splitting a line at &&, || and ; into its commands, each read on its own as #1874's fix reads a command, would take it.
- Dominant language
- Python
- Stars
- 3
- Forks
- 6
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 295
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lanl/bngsim
-
testing
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug correctness concern
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug latent bug low priority
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
benchmarks/README: 'perl BNG2.pl model.bngl' runs the whole protocol, not just generate_networkOpendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
View Counts discarded due to field name mismatchPossibly taken @rsiva0400 claimed this today. Opensite-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
spcl/HPCAgent-Bench#264 ·
Maintainers usually reply within 1 day