Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
1.1.2: fix reverbc#18
Browse files Browse the repository at this point in the history
  • Loading branch information
reverbc committed Apr 20, 2021
1 parent 081d711 commit 6267638
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

## [1.1.2] - 2021-04-19
### Fixed
- Fix #18 plugin crash when test case is marked with a non-pytest.mark decorator

## [1.1.1] - 2021-04-12
### Fixed
- Fix pytest fixture collection error on non-test modules
Expand Down
3 changes: 2 additions & 1 deletion pylint_pytest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def _is_pytest_mark(decorator):
if deco.expr.attrname == 'mark' and deco.expr.expr.name == 'pytest':
return True
except AttributeError:
return False
pass
return False


def _is_pytest_fixture(decorator, fixture=True, yield_fixture=True):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='pylint-pytest',
version='1.1.1',
version='1.1.2',
author='Reverb Chu',
author_email='[email protected]',
maintainer='Reverb Chu',
Expand Down
26 changes: 26 additions & 0 deletions tests/input/useless-pytest-mark-decorator/not_pytest_marker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import functools
from types import SimpleNamespace


def noop(func):
@functools.wraps(func)
def wrapper_noop(*args, **kwargs):
return func(*args, **kwargs)
return wrapper_noop


PYTEST = SimpleNamespace(
MARK=SimpleNamespace(
noop=noop
)
)


@noop
def test_non_pytest_marker():
pass


@PYTEST.MARK.noop
def test_non_pytest_marker_attr():
pass
4 changes: 4 additions & 0 deletions tests/test_pytest_mark_for_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ def test_mark_usefixture_using_for_fixture_function(self):
def test_other_marks_using_for_fixture(self):
self.run_linter(enable_plugin=True)
self.verify_messages(4)

def test_not_pytest_marker(self):
self.run_linter(enable_plugin=True)
self.verify_messages(0)

0 comments on commit 6267638

Please sign in to comment.