Skip to content

Commit 8deca4d

Browse files
kleptogYury Krasouski
authored andcommitted
Make tests that skip in setup phase not require investigation in reportportal (#72)
So tests that skip normally, like flake8, and tests marked with mark.skip() require no further action in the interface. If a test throws skip during the actual test itself it will still require investigation. Fixes: #58
1 parent 67269d3 commit 8deca4d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pytest_reportportal/listener.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(self, py_test_service,
1919
# Test Item result
2020
self.PyTestService = py_test_service
2121
self.result = None
22+
self.issue = {}
2223
self._log_level = log_level
2324
if PYTEST_HAS_LOGGING_PLUGIN:
2425
self._log_handler = RPLogHandler(py_test_service=py_test_service,
@@ -37,7 +38,7 @@ def pytest_runtest_protocol(self, item):
3738
yield
3839
else:
3940
yield
40-
self.PyTestService.finish_pytest_item(self.result or 'SKIPPED')
41+
self.PyTestService.finish_pytest_item(self.result or 'SKIPPED', self.issue or None)
4142

4243
@pytest.hookimpl(hookwrapper=True)
4344
def pytest_runtest_makereport(self):
@@ -52,10 +53,16 @@ def pytest_runtest_makereport(self):
5253

5354
if report.when == 'setup':
5455
self.result = None
56+
self.issue = {}
5557
if report.failed:
5658
# This happens for example when a fixture fails to run
5759
# causing the test to error
5860
self.result = 'FAILED'
61+
elif report.skipped:
62+
# This happens when a testcase is marked "skip". It will
63+
# show in reportportal as not requiring investigation.
64+
self.result = 'SKIPPED'
65+
self.issue['issue_type'] = 'NOT_ISSUE'
5966

6067
if report.when == 'call':
6168
if report.passed:

0 commit comments

Comments
 (0)