Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Configuration for pytest runner."""

from pytest_bdd import given, when
from tests.testdir_patch import testdir

pytest_plugins = "pytester"

Expand Down
20 changes: 20 additions & 0 deletions tests/testdir_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Tests that are testing config values need to be run using subprocess
to guarantee test separation and avoid messing with pytest internal state.
Pytest bug: https://github.com/pytest-dev/pytest/issues/4495

TODO: Remove this patch once above bug is fixed
"""
import pytest
from _pytest.pytester import Testdir


class PatchedTestdir(Testdir):

def makeini(self, source):
self._runpytest_method = self.runpytest_subprocess
return self.makefile(".ini", tox=source)


@pytest.fixture
def testdir(request, tmpdir_factory):
return PatchedTestdir(request, tmpdir_factory)