Fix tests: use explicit syspathinsert where tests might hang (#7008)

Use `testdir.syspathinsert()` with multiprocessing tests:

- test_chained_exceptions_no_reprcrash
- test_exception_handling_no_traceback

This only works currently because `_importtestmodule` changes `sys.path`
as a side-effect.

It appears to be only required on Windows though - likely due to the
multiprocessing method used there.
This commit is contained in:
Daniel Hahler 2020-04-04 12:33:15 +02:00 committed by GitHub
parent 5d539afd6c
commit 48c9f556ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -1264,6 +1264,7 @@ def test_exception_handling_no_traceback(testdir):
multitask_job()
"""
)
testdir.syspathinsert()
result = testdir.runpytest(p1, "--tb=long")
result.stdout.fnmatch_lines(
[

View File

@ -362,6 +362,7 @@ class TestReportSerialization:
"""
)
testdir.syspathinsert()
reprec = testdir.inline_run()
reports = reprec.getreports("pytest_runtest_logreport")