From f30d9bf0b0167910aa02b8bf27114c71a738c431 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Sat, 13 Nov 2021 21:03:49 +0100 Subject: [PATCH] Create patch release --- pytest_describe/plugin.py | 15 +++++++-------- setup.py | 2 +- tox.ini | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pytest_describe/plugin.py b/pytest_describe/plugin.py index b90584b..0eba1b7 100644 --- a/pytest_describe/plugin.py +++ b/pytest_describe/plugin.py @@ -3,10 +3,8 @@ import pytest -PYTEST_GTE_7_0 = ( - hasattr(pytest, 'version_tuple') and pytest.version_tuple >= (7, 0) -) -PYTEST_GTE_5_4 = hasattr(pytest.Collector, 'from_parent') +PYTEST_GTE_7_0 = getattr(pytest, 'version_tuple', (0, 0)) >= (7, 0) +PYTEST_GTE_5_4 = PYTEST_GTE_7_0 or hasattr(pytest.Collector, 'from_parent') def trace_function(funcobj, *args, **kwargs): @@ -66,16 +64,15 @@ class DescribeBlock(pytest.Module): @classmethod def from_parent(cls, parent, obj): + """Construct a new node for the describe block""" name = getattr(obj, '_mangled_name', obj.__name__) nodeid = parent.nodeid + '::' + name if PYTEST_GTE_7_0: self = super().from_parent( - parent=parent, path=parent.path, nodeid=nodeid, - ) + parent=parent, path=parent.path, nodeid=nodeid) elif PYTEST_GTE_5_4: self = super().from_parent( - parent=parent, fspath=parent.fspath, nodeid=nodeid, - ) + parent=parent, fspath=parent.fspath, nodeid=nodeid) else: self = cls(parent=parent, fspath=parent.fspath, nodeid=nodeid) self.name = name @@ -83,10 +80,12 @@ def from_parent(cls, parent, obj): return self def collect(self): + """Get list of children""" self.session._fixturemanager.parsefactories(self) return super().collect() def _getobj(self): + """Get the underlying Python object""" return self._importtestmodule() def _importtestmodule(self): diff --git a/setup.py b/setup.py index c3675e6..1dd025a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='pytest-describe', - version='2.0.0', + version='2.0.1', description='Describe-style plugin for pytest', long_description=readme, long_description_content_type='text/x-rst', diff --git a/tox.ini b/tox.ini index f0fa788..54535a8 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ commands = pytest -rw {posargs} [testenv:flake8] basepython = python3.9 -deps = flake8>=3.9,<4 +deps = flake8>=4,<5 commands = flake8 pytest_describe test setup.py