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

Commit 6267638

Browse files
committed
1.1.2: fix reverbc#18
1 parent 081d711 commit 6267638

File tree

5 files changed

+37
-2
lines changed

5 files changed

+37
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
## [1.1.2] - 2021-04-19
6+
### Fixed
7+
- Fix #18 plugin crash when test case is marked with a non-pytest.mark decorator
8+
59
## [1.1.1] - 2021-04-12
610
### Fixed
711
- Fix pytest fixture collection error on non-test modules

pylint_pytest/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def _is_pytest_mark(decorator):
2323
if deco.expr.attrname == 'mark' and deco.expr.expr.name == 'pytest':
2424
return True
2525
except AttributeError:
26-
return False
26+
pass
27+
return False
2728

2829

2930
def _is_pytest_fixture(decorator, fixture=True, yield_fixture=True):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name='pylint-pytest',
15-
version='1.1.1',
15+
version='1.1.2',
1616
author='Reverb Chu',
1717
author_email='[email protected]',
1818
maintainer='Reverb Chu',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import functools
2+
from types import SimpleNamespace
3+
4+
5+
def noop(func):
6+
@functools.wraps(func)
7+
def wrapper_noop(*args, **kwargs):
8+
return func(*args, **kwargs)
9+
return wrapper_noop
10+
11+
12+
PYTEST = SimpleNamespace(
13+
MARK=SimpleNamespace(
14+
noop=noop
15+
)
16+
)
17+
18+
19+
@noop
20+
def test_non_pytest_marker():
21+
pass
22+
23+
24+
@PYTEST.MARK.noop
25+
def test_non_pytest_marker_attr():
26+
pass

tests/test_pytest_mark_for_fixtures.py

+4
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ def test_mark_usefixture_using_for_fixture_function(self):
2525
def test_other_marks_using_for_fixture(self):
2626
self.run_linter(enable_plugin=True)
2727
self.verify_messages(4)
28+
29+
def test_not_pytest_marker(self):
30+
self.run_linter(enable_plugin=True)
31+
self.verify_messages(0)

0 commit comments

Comments
 (0)