Skip to content

Commit 04d5b56

Browse files
committed
Disable coverage inside test_chained_exceptions_no_reprcrash
Seeing this error in Python 3.5 on Windows: File "d:\a\pytest\pytest\.tox\py35-xdist\lib\site-packages\coverage\sqldata.py", line 1078, in executescript self.con.executescript(script) sqlite3.OperationalError: database schema has changed Workaround that by disabling coverage while running the sub test in test_chained_exceptions_no_reprcrash
1 parent 21d189e commit 04d5b56

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

testing/test_reports.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
import pytest
24
from _pytest._code.code import ExceptionChainRepr
35
from _pytest.pathlib import Path
@@ -314,9 +316,7 @@ def check_longrepr(longrepr):
314316
# elsewhere and we do check the contents of the longrepr object after loading it.
315317
loaded_report.longrepr.toterminal(tw_mock)
316318

317-
def test_chained_exceptions_no_reprcrash(
318-
self, testdir, tw_mock,
319-
):
319+
def test_chained_exceptions_no_reprcrash(self, testdir, tw_mock, monkeypatch):
320320
"""Regression test for tracebacks without a reprcrash (#5971)
321321
322322
This happens notably on exceptions raised by multiprocess.pool: the exception transfer
@@ -335,7 +335,17 @@ def test_a():
335335
p.submit(func).result()
336336
"""
337337
)
338+
# somehow on Python 3.5 the build fails with:
339+
# File "d:\a\pytest\pytest\.tox\py35-xdist\lib\site-packages\coverage\sqldata.py", line 1078, in executescript
340+
# self.con.executescript(script)
341+
# sqlite3.OperationalError: database schema has changed
342+
# disable coverage while running the sub test
343+
is_py35_win = sys.version_info <= (3, 5) and sys.platform.startswith("win")
344+
if is_py35_win:
345+
monkeypatch.delenv("COVERAGE_PROCESS_START", raising=False)
338346
reprec = testdir.inline_run()
347+
if is_py35_win:
348+
monkeypatch.undo()
339349

340350
reports = reprec.getreports("pytest_runtest_logreport")
341351

0 commit comments

Comments
 (0)