def test_section_lang(self): with open(get_path('section_lang.json')) as test_file: loader = coalaJsonLoader() html_table = HtmlReporter(loader, test_file) with open(get_path('table_test_files/section_lang.html'), 'r') as html_file: html_report = html_file.read() self.assertEqual(html_report, html_table.to_output())
def test_null_column(self): with open(get_path('null_column.json')) as test_file: loader = coalaJsonLoader() html_table = HtmlReporter(loader, test_file) with open(get_path('table_test_files/null_column.html'), 'r') as html_file: html_report = html_file.read() self.assertEqual(html_report, html_table.to_output())
def test_empty_affected_code(self): with open(get_path('empty_affected_code.json')) as test_file: loader = coalaJsonLoader() html_table = HtmlReporter(loader, test_file) with open(get_path('table_test_files/empty_affected_code.html'), 'r') as html_file: html_report = html_file.read() self.assertEqual(html_report, html_table.to_output())
def test_null_column(self): with open(get_path('null_column.json')) as test_file: loader = coalaJsonLoader() tap = TapReporter(loader, test_file) with open(get_path('tap_test_files/null_column.txt'), 'r') as tap_file: tap_report = tap_file.read() self.assertEqual(tap_report, tap.to_output())
def test_section_lang(self): with open(get_path('section_lang.json')) as test_file: loader = coalaJsonLoader() tap = TapReporter(loader, test_file) with open(get_path('tap_test_files/section_lang.txt'), 'r') as tap_file: tap_report = tap_file.read() self.assertEqual(tap_report, tap.to_output())
def test_empty_affected_code(self): with open(get_path('empty_affected_code.json')) as test_file: loader = coalaJsonLoader() tap = TapReporter(loader, test_file) with open(get_path('tap_test_files/empty_affected_code.txt'), 'r') as tap_file: tap_report = tap_file.read() self.assertEqual(tap_report, tap.to_output())
def produce_report(parser, args): if not args.input: parser.error("Please specify a 'coala-json' input file") if args.appveyor: reporter = AppveyorReporter(coalaJsonLoader(), args.input) output = reporter.to_output() else: with open(get_path(args.input)) as input_file: factory = ReporterFactory(coalaJsonLoader(), parser, input_file, args) reporter = factory.get_reporter() output = reporter.to_output() if args.output: with open(args.output, 'w+') as report: report.write(output) else: sys.stdout.write(output)
def test_appveyor_upload(self, m): loader = coalaJsonLoader() appveyor = AppveyorReporter(loader, 'report.xml') self.assertEqual(appveyor.to_output(), 'Permission denied or no such file or directory') with patch.dict('os.environ', { 'APPVEYOR_JOB_ID': '12345', 'APPVEYOR_BUILD_FOLDER': get_path() }): loader = coalaJsonLoader() appveyor = AppveyorReporter(loader, '/AppveyorReporterTest.py') m.post('https://ci.appveyor.com/api/testresults/junit/{}'.format( os.getenv('APPVEYOR_JOB_ID')), status_code=200) self.assertEqual( appveyor.to_output(), 'https://ci.appveyor.com/api/testresults/junit/{}'.format( os.getenv('APPVEYOR_JOB_ID')))
def test_severity_info(self): checkstyle_schema = xmlschema.XMLSchema(get_path('checkstyle.xsd')) with open(get_path('checkstyle_test_files/severity_info.xml')) as test: self.assertTrue(checkstyle_schema.is_valid(test)) with open(get_path('severity_info.json')) as test_file: loader = coalaJsonLoader() check = CheckstyleReporter(loader, test_file) with open(get_path('checkstyle_test_files/severity_info.xml'), 'r') as check_file: check_report = check_file.read() self.assertEqual(check_report, check.to_output())
def setUp(self): """ Set up parser """ self.loader = coalaJsonLoader() self.parser = cli.create_parser()
def test_null_column(self): junit_schema = xmlschema.XMLSchema(get_path('junit.xsd')) with open(get_path('null_column.json')) as file: loader = coalaJsonLoader() junit = JunitReporter(loader, file) self.assertTrue(junit_schema.is_valid(junit.to_output()))
def test_empty_affected_code(self): junit_schema = xmlschema.XMLSchema(get_path('junit.xsd')) with open(get_path('empty_affected_code.json')) as file: loader = coalaJsonLoader() junit = JunitReporter(loader, file) self.assertTrue(junit_schema.is_valid(junit.to_output()))
def test_null_column(self): checkstyle_schema = xmlschema.XMLSchema(get_path('checkstyle.xsd')) with open(get_path('null_column.json')) as test_file: loader = coalaJsonLoader() checkstyle = CheckstyleReporter(loader, test_file) self.assertTrue(checkstyle_schema.is_valid(checkstyle.to_output()))
def test_empty(self): with open(get_path('empty.json')) as test_file: loader = coalaJsonLoader() tap = TapReporter(loader, test_file) self.assertEqual('TAP version 13\n1..1\nok 1 - coala\n...', tap.to_output())