How to use the green.result.ProtoTest function in green

To help you get started, we’ve selected a few green examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CleanCut / green / green / result.py View on Github external
def proto_test(test):
    """
    If test is a ProtoTest, I just return it.  Otherwise I create a ProtoTest
    out of test and return it.
    """
    if isinstance(test, ProtoTest):
        return test
    else:
        return ProtoTest(test)
github CleanCut / green / green / process.py View on Github external
err = sys.exc_info()
                result.startTest(test)
                result.addError(test, err)
                result.stopTest(test)
                queue.put(result)
    else:
        # loadTargets() returned an object without a run() method, probably
        # None
        description = ('Test loader returned an un-runnable object.  Is "{}" '
                       'importable from your current location?  Maybe you '
                       'forgot an __init__.py in your directory?  Unrunnable '
                       'object looks like: {} of type {} with dir {}'
                       .format(target, str(test), type(test), dir(test))
                       )
        err = (TypeError, TypeError(description), None)
        t             = ProtoTest()
        target_list = target.split('.')
        t.module      = '.'.join(target_list[:-2]) if len(target_list) > 1 else target
        t.class_name  = target.split('.')[-2] if len(target_list) > 1 else 'UnknownClass'
        t.description = description
        t.method_name = target.split('.')[-1] if len(target_list) > 1 else 'unknown_method'
        result.startTest(t)
        result.addError(t, err)
        result.stopTest(t)
        queue.put(result)

    cleanup()
github CleanCut / green / green / result.py View on Github external
def proto_test(test):
    """
    If test is a ProtoTest, I just return it.  Otherwise I create a ProtoTest
    out of test and return it.
    """
    if isinstance(test, ProtoTest):
        return test
    else:
        return ProtoTest(test)