Repository navigation
py.test not running any tests when using -n (xdist) #669
Description
Activity
Original comment by BitBucket: vmalloc, GitHub: vmalloc:
Managed to pin the problem on a specific use case: it happens when parameters are different between workers in pytest.mark.parametrize. For instance, the following simple test will reproduce it:
#!python import time import pytest @pytest.mark.parametrize('param', [time.time(), 1, 2, 3]) def test_something(param): passIt would be helpful to at least get a clear error message explaining why things aren't running...
Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):
AFAIK when using xdist the tests collected on all hosts must have exactly the same test IDs. This means you can not have different parameters depending on the host.
You might be able to work around this in the above example by explicitly giving parameter IDs (which are used to create the test IDs):
@pytest.mark.parametrize('param', params=[time.time(), 1, 2, 3], ids=['time', '1', '2', '3']).- addedtype: bugproblem that needs to be addressedproblem that needs to be addressed
on Jun 15, 2015 When I run this with an up-to-date pytest and pytest-xdist, I get an error message instead:
================================== ERRORS =================================== ___________________________ ERROR collecting gw0 ____________________________ Different tests were collected between gw2 and gw0. The difference is: --- gw2 +++ gw0 @@ -1,4 +1,4 @@ -foo.py::test_something[1436343943.2776034] +foo.py::test_something[1436343943.234645] foo.py::test_something[1] foo.py::test_something[2] foo.py::test_something[3] ___________________________ ERROR collecting gw1 ____________________________ Different tests were collected between gw2 and gw1. The difference is: --- gw2 +++ gw1 @@ -1,4 +1,4 @@ -foo.py::test_something[1436343943.2776034] +foo.py::test_something[1436343943.2553692] foo.py::test_something[1] foo.py::test_something[2] foo.py::test_something[3] ___________________________ ERROR collecting gw3 ____________________________ Different tests were collected between gw2 and gw3. The difference is: --- gw2 +++ gw3 @@ -1,4 +1,4 @@ -foo.py::test_something[1436343943.2776034] +foo.py::test_something[1436343943.3050516] foo.py::test_something[1] foo.py::test_something[2] foo.py::test_something[3]So can this be closed, @garbas?
- addedtopic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrize
on Jul 25, 2015 Closing as duplicate of #920
Originally reported by: BitBucket: vmalloc, GitHub: vmalloc
When I run py.test without any arguments all my tests are running as expected:
However, when I pass
-n 4, nothing gets actually run: