pytest-xdist
pytest-xdist copied to clipboard
Resource warnings
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.
This is still happening and still annoying. Unfortunately I have no idea why 😭
I'm also seeing this, only on OSX. The warnings don't occur when I specify --forked or -n 0 interestingly. I think these warnings are harmless though.
I still see this on Linux if PYTHONWARNINGS=d is set. If I turn that off, then the warnings are not displayed.