Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --basetemp is not respected when used with pytest-xdist -n in 5.4.1 #6987

Closed
jdavies-st opened this issue Mar 30, 2020 · 2 comments · Fixed by #6992
Closed

Using --basetemp is not respected when used with pytest-xdist -n in 5.4.1 #6987

jdavies-st opened this issue Mar 30, 2020 · 2 comments · Fixed by #6992
Labels
plugin: xdist related to the xdist external plugin

Comments

@jdavies-st
Copy link

If I use --basetemp along with pytest-xdist, pytest-xdist breaks --basetemp control. I.e. --basetemp is ignored and the default way of setting a basetemp is done.

This seems to be new behavior in pytest 5.4.0. This worked fine in pytest 5.3.5.

An example. When running the following test:

# test.py

def test_foo(tmpdir):
    path = tmpdir.join("foo.txt")

    with open(path, 'w') as f:
        f.write("blah blah\n")

    assert 0

I get the following results:

$ pytest --basetemp=foo test.py 
================================ test session starts ================================
platform darwin -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /Users/jdavies
plugins: xdist-1.31.0, forked-1.1.3
collected 1 item                                                                    

test.py F                                                                     [100%]

===================================== FAILURES ======================================
_____________________________________ test_foo ______________________________________

tmpdir = local('/Users/jdavies/foo/test_foo0')

    def test_foo(tmpdir):
        path = tmpdir.join("foo.txt")
    
        with open(path, 'w') as f:
            f.write("blah blah\n")
    
>       assert 0
E       assert 0

test.py:9: AssertionError
============================== short test summary info ==============================
FAILED test.py::test_foo - assert 0
================================= 1 failed in 0.06s =================================
$ pytest -n 2 --basetemp=foo test.py 
================================ test session starts ================================
platform darwin -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /Users/jdavies
plugins: xdist-1.31.0, forked-1.1.3
gw0 [1] / gw1 [1]
F                                                                             [100%]
===================================== FAILURES ======================================
_____________________________________ test_foo ______________________________________
[gw0] darwin -- Python 3.8.2 /Users/jdavies/miniconda3/envs/test/bin/python

tmpdir = local('/private/var/folders/jg/by5st33j7ps356dgb4kn8w900001n5/T/pytest-of-jdavies/pytest-78/test_foo0')

    def test_foo(tmpdir):
        path = tmpdir.join("foo.txt")
    
        with open(path, 'w') as f:
            f.write("blah blah\n")
    
>       assert 0
E       assert 0

test.py:9: AssertionError
============================== short test summary info ==============================
FAILED test.py::test_foo - assert 0
================================= 1 failed in 0.39s =================================

One gets the same buggy behavior when run with many tests (instead of just one as above), and the buggy behavior happens with tmpdir_factory as well.

My environment:

$ pip list
Package        Version            
-------------- -------------------
apipkg         1.5                
attrs          19.3.0             
certifi        2019.11.28         
execnet        1.7.1              
more-itertools 8.2.0              
packaging      20.3               
pip            20.0.2             
pluggy         0.13.1             
py             1.8.1              
pyparsing      2.4.6              
pytest         5.4.1              
pytest-forked  1.1.3              
pytest-xdist   1.31.0             
setuptools     46.1.1.post20200323
six            1.14.0             
wcwidth        0.1.9              
wheel          0.34.2             
$ pytest --version
This is pytest version 5.4.1, imported from /Users/jdavies/miniconda3/envs/test/lib/python3.8/site-packages/pytest/__init__.py
setuptools registered plugins:
  pytest-xdist-1.31.0 at /Users/jdavies/miniconda3/envs/test/lib/python3.8/site-packages/xdist/plugin.py
  pytest-xdist-1.31.0 at /Users/jdavies/miniconda3/envs/test/lib/python3.8/site-packages/xdist/looponfail.py
  pytest-forked-1.1.3 at /Users/jdavies/miniconda3/envs/test/lib/python3.8/site-packages/pytest_forked/__init__.py
$ uname -prsv
Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jan 23 07:05:23 PST 2020; root:xnu-4570.71.69~1/RELEASE_X86_64 i386
$ sw_vers -productVersion
10.13.6

@blueyed
Copy link
Contributor

blueyed commented Mar 30, 2020

More a pytest-xdist issue likely (using private API that was removed), see pytest-dev/pytest-xdist#510.

@Zac-HD Zac-HD added the plugin: xdist related to the xdist external plugin label Mar 31, 2020
@RonnyPfannschmidt
Copy link
Member

its an issue with #6767 which removes a structural capability as side-effect of a "cleanup" which in turn disconnects cdist from tis hackishs way of fixing up tempdirs

we will have to undo #6767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: xdist related to the xdist external plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants