pythonpytestxdist

Concurrent pytest and namespace


I have multiple tests which I run in a concurrent mode (-n) with xdist plugin. Every test creates a personal helper object from a Helper class with specific settings. But finally attributes from different tests are mixed in objects. One test has attributes from another. test1 gets helper.test2_config.

Here is a simple example:

from helper import Helper

def test1():
    helper = Helper(test1_config)
    assert helper.test()

def test2():
    helper = Helper(test2_config)
    assert helper.test()

Solution

  • The problem was inside helper module.