Skip to content

Commit 47bc4be

Browse files
apallierallankp
authored andcommitted
Pytest 4 compatibility (#78)
* Pytest 4 compatibility * Update global version
1 parent 51e8fc8 commit 47bc4be

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pytest_testrail/plugin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ def get_testrail_keys(items):
104104
"""Return Tuple of Pytest nodes and TestRail ids from pytests markers"""
105105
testcaseids = []
106106
for item in items:
107-
if item.get_marker(TESTRAIL_PREFIX):
107+
if item.get_closest_marker(TESTRAIL_PREFIX):
108108
testcaseids.append(
109109
(
110110
item,
111111
clean_test_ids(
112-
item.get_marker(TESTRAIL_PREFIX).kwargs.get('ids')
112+
item.get_closest_marker(TESTRAIL_PREFIX).kwargs.get('ids')
113113
)
114114
)
115115
)
@@ -182,13 +182,13 @@ def pytest_runtest_makereport(self, item, call):
182182
""" Collect result and associated testcases (TestRail) of an execution """
183183
outcome = yield
184184
rep = outcome.get_result()
185-
if item.get_marker(TESTRAIL_PREFIX):
186-
testcaseids = item.get_marker(TESTRAIL_PREFIX).kwargs.get('ids')
185+
if item.get_closest_marker(TESTRAIL_PREFIX):
186+
testcaseids = item.get_closest_marker(TESTRAIL_PREFIX).kwargs.get('ids')
187187

188188
if rep.when == 'call' and testcaseids:
189189
self.add_result(
190190
clean_test_ids(testcaseids),
191-
get_test_outcome(outcome.result.outcome),
191+
get_test_outcome(outcome.get_result().outcome),
192192
comment=rep.longrepr,
193193
duration=rep.duration
194194
)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def read_file(fname):
1010
name='pytest-testrail',
1111
description='pytest plugin for creating TestRail runs and adding results',
1212
long_description=read_file('README.rst'),
13-
version='2.3.1',
13+
version='2.3.2',
1414
author='Allan Kilpatrick',
1515
author_email='[email protected]',
1616
url='http://github.com/allankp/pytest-testrail/',
@@ -19,7 +19,7 @@ def read_file(fname):
1919
],
2020
package_dir={'pytest_testrail': 'pytest_testrail'},
2121
install_requires=[
22-
'pytest>=2',
22+
'pytest>=3.6',
2323
'requests>=2.20.0',
2424
'simplejson',
2525
],

tests/test_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ def test_skip_missing_only_one_test(api_client, pytest_test_items):
338338

339339
my_plugin.pytest_collection_modifyitems(None, None, pytest_test_items)
340340

341-
assert not pytest_test_items[0].get_marker('skip')
342-
assert pytest_test_items[1].get_marker('skip')
341+
assert not pytest_test_items[0].get_closest_marker('skip')
342+
assert pytest_test_items[1].get_closest_marker('skip')
343343

344344

345345
def test_skip_missing_correlation_tests(api_client, pytest_test_items):
@@ -357,5 +357,5 @@ def test_skip_missing_correlation_tests(api_client, pytest_test_items):
357357

358358
my_plugin.pytest_collection_modifyitems(None, None, pytest_test_items)
359359

360-
assert not pytest_test_items[0].get_marker('skip')
361-
assert not pytest_test_items[1].get_marker('skip')
360+
assert not pytest_test_items[0].get_closest_marker('skip')
361+
assert not pytest_test_items[1].get_closest_marker('skip')

0 commit comments

Comments
 (0)