tests under TeamCity build. """ import os import pprint import sys import re import traceback from datetime import timedelta from teamcity.messages import TeamcityServiceMessages from teamcity.common import convert_error_to_string, dump_test_stderr, dump_test_stdout from teamcity import is_running_under_teamcity from teamcity import diff_tools diff_tools.patch_unittest_diff() def unformat_pytest_explanation(s): """ Undo _pytest.assertion.util.format_explanation """ return s.replace("\\n", "\n") def fetch_diff_error_from_message(err_message, swap_diff): line_with_diff = None diff_error_message = None lines = err_message.split("\n") if err_message.startswith("AssertionError: assert"): # Everything in one line
This should be installed as a py.test plugin and will be automatically enabled by running tests under TeamCity build. """ import os import sys import re import traceback from datetime import timedelta from teamcity.messages import TeamcityServiceMessages from teamcity.common import convert_error_to_string, dump_test_stderr, dump_test_stdout from teamcity import is_running_under_teamcity from teamcity import diff_tools diff_tools.patch_unittest_diff() def fetch_diff_error_from_message(err_message, swap_diff): line_with_diff = None diff_error_message = None lines = err_message.split("\n") if err_message.startswith("AssertionError: assert"): # Everything in one line line_with_diff = lines[0][len("AssertionError: assert "):] elif len(err_message.split("\n")) > 1: err_line = lines[1] line_with_diff = err_line[len("assert "):] diff_error_message = lines[0] if line_with_diff and line_with_diff.count("==") == 1: