pytest-dev / pytest-dev/pytest-xdist
Resource warnings
Open
Nobody has claimed this yet.
bug
help wanted
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
When running pytest with xdist I get a bunch of ResourceWarnings. To reproduce:
touch empty.py
pytest -n 2 empty.py
which produces
=============================================================== test session starts ================================================================
platform linux -- Python 3.6.1, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /home/jgosmann, inifile:
plugins: xdist-1.20.1, forked-0.2
gw0 [0] / gw1 [0]
scheduling tests via LoadScheduling
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 mode='w' encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=1 mode='w' encoding='UTF-8'>
=========================================================== no tests ran in 0.33 seconds ===========================================================
wheras
pytest empty.py
produces no warnings
=============================================================== test session starts ================================================================
platform linux -- Python 3.6.1, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /home/jgosmann, inifile:
plugins: xdist-1.20.1, forked-0.2
collected 0 items
=========================================================== no tests ran in 0.00 seconds ===========================================================
Relevant version numbers are listed in the console output.
Contributor guide
No contributing guide indexed for this repository
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 by running the reported pytest -n 2 empty.py command and compare it with pytest empty.py using the versions shown in the issue. Trace the xdist execution path responsible for the warnings; done means the parallel command no longer emits the unclosed-file ResourceWarnings while the no-test run still completes normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100