Skip to content

Commit

Permalink
pytest 3.5.0 changed how node identifiers are handled
Browse files Browse the repository at this point in the history
With node identifiers now being statically created, make sure
we change it at construction time and not expect to specify an
override every time it is looked up.

Fixes #45
  • Loading branch information
tholo committed Apr 30, 2018
1 parent 53b4b24 commit 25bbd3b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.0.1
-----

- Correct junit XML output for pytest 3.5.x

1.0.0
-----

Expand Down
4 changes: 1 addition & 3 deletions pytest_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Flake8Item(pytest.Item, pytest.File):
def __init__(self, path, parent, flake8ignore, maxlength,
maxcomplexity, showshource, statistics):
super(Flake8Item, self).__init__(path, parent)
self._nodeid += "::FLAKE8"
self.add_marker("flake8")
self.flake8ignore = flake8ignore
self.maxlength = maxlength
Expand Down Expand Up @@ -134,9 +135,6 @@ def reportinfo(self):
ignores = ""
return (self.fspath, -1, "FLAKE8-check%s" % ignores)

def _makeid(self):
return super(Flake8Item, self)._makeid() + "::FLAKE8"


class Ignorer:
def __init__(self, ignorelines, coderex=re.compile("[EW]\d\d\d")):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='pytest-flake8',
version='1.0.0',
version='1.0.1',
description='pytest plugin to check FLAKE8 requirements',
long_description=open("README.rst").read(),
classifiers=[
Expand Down Expand Up @@ -38,6 +38,6 @@
},
install_requires=[
'flake8>=3.5',
'pytest>=3.2',
'pytest>=3.5',
],
)
4 changes: 2 additions & 2 deletions test_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_default_flake8_ignores(self, testdir):
testdir.tmpdir.ensure("xy.py")
testdir.tmpdir.ensure("tests/hello.py")
result = testdir.runpytest("--flake8", "-s")
assert result.ret == 0
result.assert_outcomes(passed=2)
result.stdout.fnmatch_lines([
"*collected 2*",
"*xy.py .*",
Expand Down Expand Up @@ -184,5 +184,5 @@ def test_junit_classname(testdir):
junit = testdir.tmpdir.join("TEST.xml")
with open(str(junit)) as j_file:
j_text = j_file.read()
assert result.ret == 0
result.assert_outcomes(passed=1)
assert 'classname=""' not in j_text

0 comments on commit 25bbd3b

Please sign in to comment.