2

Currently I am running tests as follows:

py.test test.py -s -v -d --tx 3*popen

which distributes all the pytest test functions we have among 3 python processes.

class TestClass():
    def test_1():
        pass
    def test_2():
        pass
    def test_3():
        pass

I want xdist/pytest to distribute the jobs by class:

class TestClass1():
    def test_1():
        pass
class TestClass2():
    def test_2():
        pass
class TestClass3():
    def test_3():
        pass

Is there a flag I can pass pytest/xdist to do this?

ghoti
  • 45,319
  • 8
  • 65
  • 104
stihl
  • 241
  • 2
  • 6
  • 16
  • 2
    It's currently impossible to change the granularity of test distribution. But this a feature a lot of people want (including me!). There's an open issue here: https://github.com/pytest-dev/pytest-xdist/issues/18 – Chris Clark Apr 24 '16 at 00:26
  • You can use `--dist=loadscope` as stated in [this answer](https://stackoverflow.com/a/56475200/15353043). – Helge Schneider Mar 01 '22 at 10:33

0 Answers0