Skip to content

Commit

Permalink
Fix #143 - fall back to old pytest marker API for older pytest version (
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff-Meadows committed Jan 10, 2019
1 parent bc8c504 commit 7b5d9b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions flaky/flaky_pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,15 @@ def pytest_runtest_setup(self, item):
:param item:
The test item.
"""
for marker in item.iter_markers(name='flaky'):
if not self._has_flaky_attributes(item):
self._make_test_flaky(item, *marker.args, **marker.kwargs)
if not self._has_flaky_attributes(item):
if hasattr(item, 'iter_markers'):
for marker in item.iter_markers(name='flaky'):
self._make_test_flaky(item, *marker.args, **marker.kwargs)
break
elif hasattr(item, 'get_marker'):
marker = item.get_marker('flaky')
if marker:
self._make_test_flaky(item, *marker.args, **marker.kwargs)

def pytest_sessionfinish(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def main():
base_dir = dirname(__file__)
setup(
name='flaky',
version='3.5.1',
version='3.5.2',
description='Plugin for nose or pytest that automatically reruns flaky tests.',
long_description=open(join(base_dir, 'README.rst')).read(),
author='Box',
Expand Down

0 comments on commit 7b5d9b8

Please sign in to comment.