Skip to content

xdist: Different tests were collected #1075

Closed
@mhils

Description

@mhils
Steps to reproduce the problem:
  1. Create some test cases that look as follows:

    def _test(a):
        def t(self):
            assert a == a
        return t
    
    class TestFoo(object):
        test_x = _test("a")
        test_y = _test("b")
  2. Run py.test -n 4

What is the expected behavior?

The tests should pass.

What went wrong?
λ py.test test_foo.py -n 4
============================= test session starts =============================
platform win32 -- Python 3.5.0, pytest-2.8.0, py-1.4.30, pluggy-0.3.1
rootdir: C:\Users\user\git\netlib, inifile:
plugins: cov-2.1.0, xdist-1.13.1
gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2]
scheduling tests via LoadScheduling
collecting 0 items / 3 errors
=================================== ERRORS ====================================
____________________________ ERROR collecting gw0 _____________________________
Different tests were collected between gw2 and gw0. The difference is:
--- gw2

+++ gw0

@@ -1,2 +1,2 @@

+test_foo.py::TestFoo::()::test_y
 test_foo.py::TestFoo::()::test_x
-test_foo.py::TestFoo::()::test_y
=========================== 3 error in 1.17 seconds ===========================

This is the minimal test case I could break it down to. Looks like there's an issue if we're not defing functions. Any help would be appreciated! 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: xdistrelated to the xdist external pluginstatus: help wanteddevelopers would like help from experts on this topictopic: collectionrelated to the collection phasetype: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogtype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions