Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced block structure to build log, if output is not captured #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions teamcity/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import re
import traceback
from datetime import timedelta
import pytest

from teamcity.messages import TeamcityServiceMessages
from teamcity.common import convert_error_to_string, dump_test_stderr, dump_test_stdout
Expand Down Expand Up @@ -327,6 +328,33 @@ def pytest_terminal_summary(self):
tb = traceback.format_exc()
self.teamcity.customMessage("Coverage statistics reporting failed", "ERROR", errorDetails=tb)

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_setup(self,item):
if not self.output_capture_enabled:
self.teamcity.blockOpened('setup')
yield
self.teamcity.blockClosed('setup')
else:
yield

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(self,item):
if not self.output_capture_enabled:
self.teamcity.blockOpened('call')
yield
self.teamcity.blockClosed('call')
else:
yield

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_teardown(self,item):
if not self.output_capture_enabled:
self.teamcity.blockOpened('teardown')
yield
self.teamcity.blockClosed('teardown')
else:
yield

def _report_coverage(self):
from coverage.misc import NotPython
from coverage.report import Reporter
Expand Down