def main(tc_user: str, tc_password: str):
    errors = []
    triggered_builds: dict[str, int] = {}
    tc = TeamCity(TC_URL, auth=(tc_user, tc_password))
    tests_info = AutoTestsInfo.get_current(tc)
    tc_msg = TeamcityServiceMessages()
    if tests_info.re_run_builds:
        click.echo("Re run failed builds")
    else:
        click.echo("Run automated tests")

    with tc_msg.testSuite("Automation tests"):
        tc_msg.testCount(len(tests_info.supported_shells))
        for shell_name in tests_info.supported_shells:
            try:
                build_id = _run_tests_for_shell(tc, tc_msg, shell_name,
                                                tests_info)
                if build_id:
                    triggered_builds[shell_name] = build_id
            except Exception as e:
                errors.append(e)
                click.echo(e, err=True)

        builds_statuses, new_errors = _wait_build_finish(
            tc, tc_msg, triggered_builds)
        errors.extend(new_errors)

        if errors:
            raise Exception("There were errors running automation tests.")
    return all(builds_statuses.values())
Beispiel #2
0
def test_test_suite():
    stream = StreamStub()
    messages = TeamcityServiceMessages(output=stream, now=lambda: fixed_date)
    with messages.testSuite('suite emotion'):
        pass
    assert stream.observed_output.strip() == textwrap.dedent("""\
        ##teamcity[testSuiteStarted timestamp='2000-11-02T10:23:01.556' name='suite emotion']
        ##teamcity[testSuiteFinished timestamp='2000-11-02T10:23:01.556' name='suite emotion']
        """).strip().encode('utf-8')
Beispiel #3
0
def test_test_suite():
    stream = StreamStub()
    messages = TeamcityServiceMessages(output=stream, now=lambda: fixed_date)
    with messages.testSuite('suite emotion'):
        pass
    assert stream.observed_output.strip() == textwrap.dedent("""\
        ##teamcity[testSuiteStarted timestamp='2000-11-02T10:23:01.556' name='suite emotion']
        ##teamcity[testSuiteFinished timestamp='2000-11-02T10:23:01.556' name='suite emotion']
        """).strip().encode('utf-8')