Пример #1
0
        def test_start(self, log_state):  # pylint: disable=redefined-outer-name
            """Test that the start method doesn't have output."""
            quiet = log.DummyLog(log_state, threading.Lock())
            quiet.start('foo')
            sys.stdout.seek(0)

            actual = sys.stdout.read()
            assert actual == b''
Пример #2
0
        def test_summary(self, log_state):  # pylint: disable=redefined-outer-name
            """Test the output of the summary method."""
            quiet = log.DummyLog(log_state, threading.Lock())
            quiet.summary()
            sys.stdout.seek(0)

            actual = sys.stdout.read()
            assert actual == b''
Пример #3
0
def test_noprint_when_expected():
    """ Generate tests for methods that shouldn't print

    some methods shouldn't print anything, ensure that they don't

    """
    # a list of tuples which element 1 is the name of the class and method
    # element 2 is a callable, and element 3 is a list of arguments to be
    # passed to that callable. it needs to work with the splat operator
    printing = []

    # Test QuietLog
    quiet = log.QuietLog(TEST_STATE)
    printing.append(('QuietLog.start', quiet.start, ['name']))

    # Test DummyLog
    dummy = log.DummyLog(TEST_STATE)
    printing.append(('DummyLog.start', dummy.start, ['name']))
    printing.append(('DummyLog.log', dummy.log, ['pass']))
    printing.append(('DummyLog.summary', dummy.summary, []))

    for name, func, args in printing:
        check_no_output.description = "{} produces no output".format(name)
        yield check_no_output, func, args