From 0d0bea216fc6a7b9e32f176702e43fd39b0b78d4 Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Tue, 5 Feb 2019 18:06:46 +0300 Subject: [PATCH 1/3] Skip hook if cov disabled --- src/pytest_cov/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index 2ea47f64..619b9a38 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -195,7 +195,8 @@ def pytest_configure_node(self, node): Mark this hook as optional in case xdist is not installed. """ - self.cov_controller.configure_node(node) + if not self._disabled: + self.cov_controller.configure_node(node) pytest_configure_node.optionalhook = True def pytest_testnodedown(self, node, error): @@ -203,7 +204,8 @@ def pytest_testnodedown(self, node, error): Mark this hook as optional in case xdist is not installed. """ - self.cov_controller.testnodedown(node, error) + if not self._disabled: + self.cov_controller.testnodedown(node, error) pytest_testnodedown.optionalhook = True def _should_report(self): From b131c76db576042dc60e5607d080f198b77e8a29 Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Tue, 5 Feb 2019 19:13:30 +0300 Subject: [PATCH 2/3] Update authors/changelog.rst --- AUTHORS.rst | 1 + CHANGELOG.rst | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 41cc6055..78f18f13 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -28,3 +28,4 @@ Authors * Jeremy Bowman - https://github.com/jmbowman * Samuel Giffard - https://github.com/Mulugruntz * Семён Марьясин - https://github.com/MarSoft +* Alexander Shadchin - https://github.com/shadchin diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0583e5ac..1bb5b4fd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +2.6.2 (2019-02-05) +------------------ + +* Fixed ``'NoneType' object has no attribute 'configure_node'`` issue. + Contributed by Alexander Shadchin in `#263 `_. + 2.6.1 (2019-01-07) ------------------ From f894b9af4ca1829068a2e260d0965adcf15cec30 Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Tue, 5 Feb 2019 19:41:53 +0300 Subject: [PATCH 3/3] Add test --- tests/test_pytest_cov.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index b3600794..da44e19a 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -1439,3 +1439,13 @@ def test_double_cov2(testdir): '*1 passed*' ]) assert result.ret == 0 + + +def test_cov_and_no_cov(testdir): + script = testdir.makepyfile(SCRIPT_SIMPLE) + result = testdir.runpytest('-v', + '--cov', '--no-cov', + '-n', '1', + script) + + assert result.ret == 0