Top

Module pybuilder.ci_server_interaction

from pybuilder.terminal import print_text


def test_proxy_for(project):
    if project.get_property('teamcity_output') and not project.get_property('__running_coverage'):
        return TeamCityTestProxy()
    else:
        return TestProxy()


def flush_text_line(text_line):
    print_text(text_line + '\n', flush=True)


class TestProxy(object):

    def __init__(self, test_name='not set'):
        self.test_name = test_name

    def and_test_name(self, test_name):
        self.test_name = test_name
        return self

    def test_starts(self):
        pass

    def test_finishes(self):
        pass

    def fails(self, reason):
        pass

    def __enter__(self, *args, **kwargs):
        self.test_starts()
        return self

    def __exit__(self, *args, **kwargs):
        self.test_finishes()


class TeamCityTestProxy(TestProxy):

    def test_starts(self):
        flush_text_line("##teamcity[testStarted name='{0}']".format(self.test_name))

    def test_finishes(self):
        flush_text_line("##teamcity[testFinished name='{0}']".format(self.test_name))

    def fails(self, reason):
        flush_text_line("##teamcity[testFailed name='{0}' message='See details' details='{1}']".format(
                        self.test_name,
                        reason
                        ))

Index

Functions

def flush_text_line(

text_line)

def flush_text_line(text_line):
    print_text(text_line + '\n', flush=True)

def test_proxy_for(

project)

def test_proxy_for(project):
    if project.get_property('teamcity_output') and not project.get_property('__running_coverage'):
        return TeamCityTestProxy()
    else:
        return TestProxy()

Classes

class TeamCityTestProxy

class TeamCityTestProxy(TestProxy):

    def test_starts(self):
        flush_text_line("##teamcity[testStarted name='{0}']".format(self.test_name))

    def test_finishes(self):
        flush_text_line("##teamcity[testFinished name='{0}']".format(self.test_name))

    def fails(self, reason):
        flush_text_line("##teamcity[testFailed name='{0}' message='See details' details='{1}']".format(
                        self.test_name,
                        reason
                        ))

Ancestors (in MRO)

Instance variables

var test_name

Inheritance: TestProxy.test_name

Methods

def __init__(

self, test_name='not set')

Inheritance: TestProxy.__init__

def __init__(self, test_name='not set'):
    self.test_name = test_name

def and_test_name(

self, test_name)

Inheritance: TestProxy.and_test_name

def and_test_name(self, test_name):
    self.test_name = test_name
    return self

def fails(

self, reason)

Inheritance: TestProxy.fails

def fails(self, reason):
    flush_text_line("##teamcity[testFailed name='{0}' message='See details' details='{1}']".format(
                    self.test_name,
                    reason
                    ))

def test_finishes(

self)

Inheritance: TestProxy.test_finishes

def test_finishes(self):
    flush_text_line("##teamcity[testFinished name='{0}']".format(self.test_name))

def test_starts(

self)

Inheritance: TestProxy.test_starts

def test_starts(self):
    flush_text_line("##teamcity[testStarted name='{0}']".format(self.test_name))

class TestProxy

class TestProxy(object):

    def __init__(self, test_name='not set'):
        self.test_name = test_name

    def and_test_name(self, test_name):
        self.test_name = test_name
        return self

    def test_starts(self):
        pass

    def test_finishes(self):
        pass

    def fails(self, reason):
        pass

    def __enter__(self, *args, **kwargs):
        self.test_starts()
        return self

    def __exit__(self, *args, **kwargs):
        self.test_finishes()

Ancestors (in MRO)

Instance variables

var test_name

Methods

def __init__(

self, test_name='not set')

def __init__(self, test_name='not set'):
    self.test_name = test_name

def and_test_name(

self, test_name)

def and_test_name(self, test_name):
    self.test_name = test_name
    return self

def fails(

self, reason)

def fails(self, reason):
    pass

def test_finishes(

self)

def test_finishes(self):
    pass

def test_starts(

self)

def test_starts(self):
    pass

Documentation generated by pdoc 0.2.3. pdoc is in the public domain with the UNLICENSE.