def test_non_working_reporter_does_not_report(self) -> None: self.assertFileDoesNotExist(self.approved_file_path) reporter = GenericDiffReporter(create_config(["Custom", "NotReal"])) success = reporter.report(self.received_file_path, self.approved_file_path) self.assertFalse(success)
def test_pycharm_diff_command(): reporter = GenericDiffReporter([ "PyCharm", '/Applications/PyCharm CE.app/Contents/MacOS/pycharm', ["diff"] ]) received_path = "received.txt" approved_path = "approved.txt" verify(str(reporter.get_command(received_path, approved_path)))
def test_non_working_reporter_does_not_report(self): self.assertFileDoesNotExist(self.approved_file_path) reporter = GenericDiffReporter(('Custom', 'NotReal')) success = reporter.report(self.received_file_path, self.approved_file_path) self.assertFalse(success)
def test_simple(self): verify( "Hello", options=Options().with_reporter( GenericDiffReporter.create( r"C:\my\favorite\diff\utility.exe")), )
def _test_string_representation(self) -> None: reporter = GenericDiffReporter(create_config(["Custom", "NotReal"])) expected = "GenericDiffReporter(...)" self.assertEqual(expected, str(reporter))
def instantiate_reporter_for_test() -> GenericDiffReporter: program = r"C:\Windows\System32\help.exe" if is_windows_os() else "echo" reporter = GenericDiffReporter.create(program) setattr(reporter, "run_command", lambda command_array: None) return reporter
def test_notworking_in_environment(self) -> None: reporter = GenericDiffReporter(create_config(["Custom", "NotReal"])) self.assertFalse(reporter.is_working())
def _create_reporter( config: GenericDiffReporterConfig) -> GenericDiffReporter: return GenericDiffReporter(config)
def setUp(self): reporter = MultiReporter(GenericDiffReporter.create('diff'), CommandLineReporter()) approvals.set_default_reporter(reporter)
def verify(fn, args): verify_all_combinations(fn, args, reporter=GenericDiffReporter(('meld', 'meld')))
def instantiate_reporter_for_test(): reporter = GenericDiffReporter.create('echo') reporter.run_command = lambda command_array: None return reporter
def test_notworking_in_environment(self): reporter = GenericDiffReporter(('Custom', 'NotReal')) self.assertFalse(reporter.is_working())
def setUp(self): self.reporter = GenericDiffReporter( ("Tortoise", "C:/Program Files/TortoiseSVN/bin/tortoisemerge.exe"))
def setUp(self) -> None: reporter = MultiReporter(GenericDiffReporter.create("diff"), CommandLineReporter())
def get(self, reporter_name): config = next((r for r in self.reporters if r[0] == reporter_name), None) if not config: return None return GenericDiffReporter(config)
def _create_reporter(config): if not config: return None return GenericDiffReporter(config)
def get_all_reporters(self): instances = (GenericDiffReporter(r) for r in self.reporters) return instances
def instantiate_reporter_for_test(): program = r'C:\Windows\System32\help.exe' if is_windows_os( ) else 'echo' reporter = GenericDiffReporter.create(program) reporter.run_command = lambda command_array: None return reporter