python-pytest-cov/pytest62.patch

32 lines
1.2 KiB
Diff
Raw Normal View History

From 25eed212085ce9a2d5383a6a4a2b360d0d514f89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= <contact@ionelmc.ro>
Date: Mon, 11 Jan 2021 15:49:18 +0200
Subject: [PATCH] Turns out there were some internal changes in the pytester
plugin.
---
tests/test_pytest_cov.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py
index f0fd6ca..c6511aa 100644
--- a/tests/test_pytest_cov.py
+++ b/tests/test_pytest_cov.py
@@ -1538,8 +1538,14 @@ def test_cover_looponfail(testdir, monkeypatch):
testdir.makeconftest(CONFTEST)
script = testdir.makepyfile(BASIC_TEST)
- monkeypatch.setattr(testdir, 'run',
- lambda *args, **kwargs: _TestProcess(*map(str, args)))
+ def mock_run(*args, **kwargs):
+ return _TestProcess(*map(str, args))
+
+ monkeypatch.setattr(testdir, 'run', mock_run)
+ assert testdir.run is mock_run
+ if hasattr(testdir, '_pytester'):
+ monkeypatch.setattr(testdir._pytester, 'run', mock_run)
+ assert testdir._pytester.run is mock_run
with testdir.runpytest('-v',
'--cov=%s' % script.dirpath(),
'--looponfail',