class TestSelectReporter(unittest.TestCase):
    def setUp(self):
        self.factory = GenericDiffReporterFactory()

    def test_simple(self):
        verify("Hello",
               options=Options().with_reporter(
                   self.factory.get("BeyondCompare")))
Example #2
0
def get_reporter(custom_reporter, custom_reporter_args, reporter_name):
    factory = GenericDiffReporterFactory()
    if custom_reporter:
        args = get_reporter_args(custom_reporter_args)
        reporter = create_reporter(factory, custom_reporter, args)
    else:
        reporter = factory.get(reporter_name)
        if reporter is None and reporter_name == "PythonNative":
            reporter = PythonNativeReporter()
    return reporter
Example #3
0
def pytest_configure(config):
    factory = GenericDiffReporterFactory()

    if config.option.approvaltests_custom_reporter:
        args_str = config.option.approvaltests_custom_reporter_args
        if args_str:
            args = args_str.split(',')
        else:
            args = []
        custom_reporter_name = "Custom"
        reporter_config = [
            custom_reporter_name, config.option.approvaltests_custom_reporter,
            args
        ]
        factory.add_default_reporter_config(reporter_config)
        reporter = factory.get(custom_reporter_name)
    else:
        reporter = factory.get(config.option.approvaltests_reporter)

    approvaltests.set_default_reporter(reporter)
def pytest_configure(config):
    factory = GenericDiffReporterFactory()

    custom_reporter = config.option.approvaltests_custom_reporter
    if custom_reporter:
        args = get_reporter_args(
            config.option.approvaltests_custom_reporter_args)
        reporter = create_reporter(factory, custom_reporter, args)
    else:
        reporter = factory.get(config.option.approvaltests_reporter)
        if reporter is None and config.option.approvaltests_reporter == "PythonNative":
            reporter = PythonNativeReporter()

    approvaltests.set_default_reporter(reporter)
class TestSelectReporter(unittest.TestCase):
    def setUp(self):
        self.factory = GenericDiffReporterFactory()

    def test_simple(self):
        verify('Hello', self.factory.get('BeyondCompare4'))
def test_fallback_reporter():
    factory = GenericDiffReporterFactory()
    fallback_reporter = factory.get("PythonNative")
    assert fallback_reporter.is_working()