Skip to content

Commit

Permalink
Create patch release
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Nov 13, 2021
1 parent 88cbe22 commit f30d9bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions pytest_describe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -66,27 +64,28 @@ 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
self.funcobj = 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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f30d9bf

Please sign in to comment.