pytest-dev / pytest-dev/pytest
basetemp should not be collected
Open
Nobody has claimed this yet.
topic: collection
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
when using a basetemp in the test collection source directory and adding valid, failing pytests to it the tests are collected before the basetemp directory is ensure_reset_dir'd
related to https://github.com/pytest-dev/pytest/issues/7940
def test_basetemp_not_collected(testdir):
testdir.makepyfile(
r"""
def test(tmp_path):
(tmp_path / "test_fail.py").write_text(
"def test_fail():\n assert False"
)
"""
)
assert testdir.runpytest("--basetemp=tmp").ret == 0
# running a second time and ensure we don't crash
assert testdir.runpytest("--basetemp=tmp").ret == 0
Contributor 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.
Research direction
Start with the supplied test_basetemp_not_collected regression test and trace how --basetemp is handled before collection. Run the test twice with the generated failing test file, and consider the issue complete when both runs return 0 without collecting that file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100