pytest-dev / pytest-dev/pytest-xdist
xdist chooses the wrong package version
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
When installing two different versions of a package in the same environment, xdist doesn't pick the same version as regular pytest.
Steps to reproduce using Invoke package for instance:
virtualenv ENV && source ENV/bin/activate
pip install pytest pytest-xdist invoke==0.11.0
Download the source of Invoke 0.12.2 and install it with python setup.py install.
I have a dummy test file test_version.py, containing:
import invoke
def test_version():
assert False, str(invoke.__version__)
When running py.test test_version.py, we see that the test is running with Invoke 0.12.2:
============================ test session starts =============================
platform darwin -- Python 2.7.10, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /Users/jcruy/Desktop/xdist_bug, inifile:
plugins: xdist-1.14
collected 1 items
test_version.py F
================================== FAILURES ==================================
________________________________ test_version ________________________________
def test_version():
> assert False, str(invoke.__version__)
E AssertionError: 0.12.2
E assert False
test_version.py:5: AssertionError
========================== 1 failed in 0.09 seconds ==========================
However, when running it with xdist (py.test test_version.py -n 2), we see that the test is running with Invoke 0.11.0:
============================ test session starts =============================
platform darwin -- Python 2.7.10, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /Users/jcruy/Desktop/xdist_bug, inifile:
plugins: xdist-1.14
gw0 [1] / gw1 [1]
scheduling tests via LoadScheduling
F
================================== FAILURES ==================================
________________________________ test_version ________________________________
[gw1] darwin -- Python 2.7.10 /Users/jcruy/Desktop/xdist_bug/ENV/bin/python
def test_version():
> assert False, str(invoke.__version__)
E AssertionError: 0.11.0
E assert False
test_version.py:5: AssertionError
========================== 1 failed in 0.45 seconds ==========================
Notes:
- I chose the Invoke package for example's sake only, it happens with other packages as well.
- I know that it's not a really good thing to install two versions of a packages in the same environment, but I believe that the behaviour between
pytestandxdistshould at least be consistent. - I would gladly contribute to a fix, if you point me to the area of the code which might be responsible for that.
Environment:
- OS X 10.11.4
- Python 2.7.10
- pytest 2.9.2
- pytest-xdist 1.14
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
Reproduce the mismatch with test_version.py using the reported virtualenv, Invoke versions, pytest command, and -n 2 xdist command. Compare the package version selected by regular pytest and each xdist worker; done means both execution modes consistently select the same version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100