示例#1
0
class _BacktraceBase(plugin_test_helper.resolve_helper_class()):
    """
    Kind of a first stab at a more general plugin tester. I want to use
    the same suitepath based test file, but I want to have a test for each
    log file and so on.

    subclasses need to define klass._backtrace_finder_file and
    klass._backtrace_finger_count. This base class will verify that the
    backtrace appears in that file the expected number of times
    """
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging', 'backtrace')
    _test_file = 'test_backtrace'
    _test_class = 'TestLoggerBacktrace'
    _test_methods = ['test_backtrace_from_oops']
    _expect_nose_success = False

    def setUp(self):
        self.__logfile_checker = TempLogfileChecker(
            self._backtrace_finder_file)
        super(_BacktraceBase, self).setUp()

    def verify(self):
        self.__logfile_checker.check_backtrace(self, 'ERROR', self.suitepath,
                                               self._test_class,
                                               self._test_file + '.py',
                                               self._test_methods[0],
                                               self._backtrace_finder_count)

        self._check_sequence_pre_test()
        self._check_sequences(self._test_methods, self._test_class,
                              self._test_file)
        self._check_sequence_post_test()
示例#2
0
class TestSMPSingleOkSequence(plugin_test_helper.resolve_helper_class()):
    suitepath = plugin_test_helper.resolve_suitepath('stream-base', 'one_pass')

    def verify(self):
        self._check_sequence_pre_test()
        self._check_sequence_test('test_one_pass.test_one')
        self._check_sequence_post_test()
示例#3
0
class TestSMPLoggingSingleOk(plugin_test_helper.resolve_helper_class()):
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging', 'one_pass')

    def verify(self):
        self._check_sequence_pre_test()
        self._check_sequence_test(
            'test_single_log_to_run (test_one_log_pass.TestOneLoggerTest)')
        self._check_sequence_post_test()
示例#4
0
class _StderrNoCaptureBase(_CaptureBase):
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging', 'stderr_nocap')
    _test_file = 'test_stderr_nocap'
    _test_class = 'TestLoggerStderrNoError'
    _test_methods = ['test_stderr_from_testcase']
    _capture_type = 'stderr'
    _capture_level = 'ERROR'  # doesn't really matter, since counts are all zero.
    _capture_finder_count = 0
    _expect_nose_success = False
示例#5
0
class TestSMPLoggingTwoOk(plugin_test_helper.resolve_helper_class()):
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging', 'two_pass')
    _test_file = 'test_two_log_pass'
    _test_class = 'TestTwoLoggerTest'
    _test_methods = ['test_one_of_two_to_run', 'test_two_of_two_to_run']

    def verify(self):
        self._check_sequence_pre_test()
        self._check_sequences(self._test_methods, self._test_class,
                              self._test_file)
        self._check_sequence_post_test()
示例#6
0
class _StderrFailCaptureBase(_CaptureBase):
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging',
                                                     'stderr_failcap')
    _test_file = 'test_stderr_failcap'
    _test_class = 'TestLoggerStderrFail'
    _test_methods = [
        'test_no_stderr_from_testcase', 'test_stderr_from_testcase'
    ]
    _capture_type = 'stderr'
    _capture_level = 'WARNING'
    _capture_method = 'test_stderr_from_testcase'
    _expect_nose_success = False
示例#7
0
class _StdoutErrCaptureBase(_CaptureBase):
    suitepath = plugin_test_helper.resolve_suitepath('stream-source',
                                                     'logging',
                                                     'stdout_errcap')
    _test_file = 'test_stdout_errcap'
    _test_class = 'TestLoggerStdoutError'
    _test_methods = [
        'test_no_stdout_from_testcase', 'test_stdout_from_testcase'
    ]
    _capture_type = 'stdout'
    _capture_level = 'ERROR'
    _capture_method = 'test_stdout_from_testcase'
    _expect_nose_success = False