Merge pull request #6797 from blueyed/tests-simpler

tests: simplify test_pytest_plugins_in_non_top_level_conftest_…
This commit is contained in:
Ran Benita 2020-05-05 21:51:50 +03:00 committed by GitHub
commit a8dbb32a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 20 deletions

View File

@ -1456,27 +1456,16 @@ class TestPytestPluginsVariable:
def test_pytest_plugins_in_non_top_level_conftest_unsupported_no_false_positives( def test_pytest_plugins_in_non_top_level_conftest_unsupported_no_false_positives(
self, testdir self, testdir
): ):
subdirectory = testdir.tmpdir.join("subdirectory")
subdirectory.mkdir()
testdir.makeconftest(
"""
pass
"""
)
testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py"))
testdir.makeconftest(
"""
import warnings
warnings.filterwarnings('always', category=DeprecationWarning)
pytest_plugins=['capture']
"""
)
testdir.makepyfile( testdir.makepyfile(
""" "def test_func(): pass",
def test_func(): **{
pass "subdirectory/conftest": "pass",
""" "conftest": """
import warnings
warnings.filterwarnings('always', category=DeprecationWarning)
pytest_plugins=['capture']
""",
}
) )
res = testdir.runpytest_subprocess() res = testdir.runpytest_subprocess()
assert res.ret == 0 assert res.ret == 0