From 32bc3b809cc747614da9f4aab470d1db10a0cbff Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 6 Jan 2019 18:56:31 +0100 Subject: [PATCH] Use get_closest_marker Fixes pytest-cov with pytest 4.1. Requires pytest 3.6+ now. --- setup.py | 2 +- src/pytest_cov/plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 885f2b93..42f72308 100644 --- a/setup.py +++ b/setup.py @@ -121,7 +121,7 @@ def run(self): 'cover', 'coverage', 'pytest', 'py.test', 'distributed', 'parallel', ], install_requires=[ - 'pytest>=2.9', + 'pytest>=3.6', 'coverage>=4.4' ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index 39f304c6..2ea47f64 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -293,7 +293,7 @@ def pytest_runtest_teardown(self, item): @compat.hookwrapper def pytest_runtest_call(self, item): - if (item.get_marker('no_cover') + if (item.get_closest_marker('no_cover') or 'no_cover' in getattr(item, 'fixturenames', ())): self.cov_controller.pause() yield