summaryrefslogtreecommitdiff
path: root/testing/test_reports.py
diff options
context:
space:
mode:
authorFlorian Dahlitz <f2dahlitz@freenet.de>2020-05-25 13:53:56 +0200
committerFlorian Dahlitz <f2dahlitz@freenet.de>2020-05-25 13:57:03 +0200
commit6546d1f7257d986c2598dd2ebd2bbd8d04285585 (patch)
tree1b14d8223cfd4823c6e5d4c7ce04ce42233b207e /testing/test_reports.py
parent981b0969404bc4116659dae8fa6318cfbab2c942 (diff)
downloadpytest-6546d1f7257d986c2598dd2ebd2bbd8d04285585.tar.gz
Prevent pytest from printing ConftestImportFailure traceback
Diffstat (limited to 'testing/test_reports.py')
-rw-r--r--testing/test_reports.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/test_reports.py b/testing/test_reports.py
index 13f593215..64d86e953 100644
--- a/testing/test_reports.py
+++ b/testing/test_reports.py
@@ -396,6 +396,18 @@ class TestReportSerialization:
# for same reasons as previous test, ensure we don't blow up here
loaded_report.longrepr.toterminal(tw_mock)
+ def test_report_prevent_ConftestImportFailure_hiding_exception(self, testdir):
+ sub_dir = testdir.tmpdir.join("ns").ensure_dir()
+ sub_dir.join("conftest").new(ext=".py").write("import unknown")
+
+ result = testdir.runpytest_subprocess(".")
+ result.stdout.fnmatch_lines(
+ ["E ModuleNotFoundError: No module named 'unknown'"]
+ )
+ result.stdout.no_fnmatch_line(
+ "ERROR - _pytest.config.ConftestImportFailure: ModuleNotFoundError:*"
+ )
+
class TestHooks:
"""Test that the hooks are working correctly for plugins"""