diff options
author | 2020-05-26 11:07:51 +0200 | |
---|---|---|
committer | 2020-05-26 11:25:01 +0200 | |
commit | e6a8ae1767dfe7da974902c07f1c112999b1a6fc (patch) | |
tree | a2c5a673162931d1b46e597713578c70bccb81bf /dev-python/pytest-mock | |
parent | dev-python/path-py: Bump to 14.0.1 (diff) | |
download | gentoo-e6a8ae1767dfe7da974902c07f1c112999b1a6fc.tar.gz gentoo-e6a8ae1767dfe7da974902c07f1c112999b1a6fc.tar.bz2 gentoo-e6a8ae1767dfe7da974902c07f1c112999b1a6fc.zip |
dev-python/pytest-mock: Fix test fail due to pytest plugins
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pytest-mock')
4 files changed, 85 insertions, 2 deletions
diff --git a/dev-python/pytest-mock/files/pytest-mock-2.0.0-warnings.patch b/dev-python/pytest-mock/files/pytest-mock-2.0.0-warnings.patch new file mode 100644 index 000000000000..bea2bb14b15d --- /dev/null +++ b/dev-python/pytest-mock/files/pytest-mock-2.0.0-warnings.patch @@ -0,0 +1,36 @@ +From 09477f0d28f3b6b9fa36b861d701c9d1a937e553 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 26 May 2020 10:56:27 +0200 +Subject: [PATCH] Permit warnings in *_stale_pyc tests + +The *_stale_pyc test is repeatedly failing on production systems +due to additional pytest plugins being installed and triggering +PytestAssertRewriteWarnings. This causes 'passed *' string not to match +because of the ',' after 'passed'. Match just 'passed*' instead +to solve this. +--- + tests/test_pytest_mock.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py +index d1635f5..e85f392 100644 +--- a/tests/test_pytest_mock.py ++++ b/tests/test_pytest_mock.py +@@ -801,7 +801,7 @@ def test_abort_patch_context_manager_with_stale_pyc(testdir): + """ + ) + result = testdir.runpytest() +- result.stdout.fnmatch_lines("* 1 passed *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + kwargs = {"legacy": True} if sys.version_info[0] >= 3 else {} + assert compileall.compile_file(str(py_fn), **kwargs) +@@ -811,4 +811,4 @@ def test_abort_patch_context_manager_with_stale_pyc(testdir): + + py_fn.remove() + result = testdir.runpytest() +- result.stdout.fnmatch_lines("* 1 passed *") ++ result.stdout.fnmatch_lines("* 1 passed*") +-- +2.26.2 + diff --git a/dev-python/pytest-mock/files/pytest-mock-3.1.0-warnings.patch b/dev-python/pytest-mock/files/pytest-mock-3.1.0-warnings.patch new file mode 100644 index 000000000000..4851afe9d1ba --- /dev/null +++ b/dev-python/pytest-mock/files/pytest-mock-3.1.0-warnings.patch @@ -0,0 +1,39 @@ +From 1ef3d6111a8e4f32dfa9a2c311b6996afd9e98a5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 26 May 2020 10:56:27 +0200 +Subject: [PATCH] Permit warnings in *_stale_pyc tests + +The *_stale_pyc test is repeatedly failing on production systems +due to additional pytest plugins being installed and triggering +PytestAssertRewriteWarnings. This causes 'passed *' string not to match +because of the ',' after 'passed'. Match just 'passed*' instead +to solve this. +--- + tests/test_pytest_mock.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py +index 73509a4..5e1a502 100644 +--- a/tests/test_pytest_mock.py ++++ b/tests/test_pytest_mock.py +@@ -809,7 +809,7 @@ def test_abort_patch_context_manager_with_stale_pyc(testdir): + """ + ) + result = testdir.runpytest() +- result.stdout.fnmatch_lines("* 1 passed *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + kwargs = {"legacy": True} + assert compileall.compile_file(str(py_fn), **kwargs) +@@ -819,7 +819,7 @@ def test_abort_patch_context_manager_with_stale_pyc(testdir): + + py_fn.remove() + result = testdir.runpytest() +- result.stdout.fnmatch_lines("* 1 passed *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + + def test_used_with_class_scope(testdir): +-- +2.26.2 + diff --git a/dev-python/pytest-mock/pytest-mock-2.0.0.ebuild b/dev-python/pytest-mock/pytest-mock-2.0.0.ebuild index 9f85be239d87..2cdc00ffc242 100644 --- a/dev-python/pytest-mock/pytest-mock-2.0.0.ebuild +++ b/dev-python/pytest-mock/pytest-mock-2.0.0.ebuild @@ -24,6 +24,10 @@ BDEPEND=" distutils_enable_tests pytest +PATCHES=( + "${FILESDIR}"/pytest-mock-2.0.0-warnings.patch +) + src_prepare() { if has_version dev-python/mock; then # test fails when standalone mock is installed diff --git a/dev-python/pytest-mock/pytest-mock-3.1.0.ebuild b/dev-python/pytest-mock/pytest-mock-3.1.0.ebuild index b5ce25c092dc..47689f34aa07 100644 --- a/dev-python/pytest-mock/pytest-mock-3.1.0.ebuild +++ b/dev-python/pytest-mock/pytest-mock-3.1.0.ebuild @@ -14,15 +14,19 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" LICENSE="MIT" SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~sparc ~x86" IUSE="" -RDEPEND="dev-python/pytest[${PYTHON_USEDEP}]" +RDEPEND=">=dev-python/pytest-5[${PYTHON_USEDEP}]" BDEPEND=" dev-python/setuptools_scm[${PYTHON_USEDEP}]" distutils_enable_tests pytest +PATCHES=( + "${FILESDIR}"/pytest-mock-3.1.0-warnings.patch +) + src_prepare() { if has_version dev-python/mock; then # test fails when standalone mock is installed |