From ecc3cca7b66308b98007d965f0ef71ab24339924 Mon Sep 17 00:00:00 2001 From: Enrico Minack Date: Mon, 23 May 2022 13:22:24 +0200 Subject: [PATCH] Fix parse errors for Windows --- python/test/test_junit.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/python/test/test_junit.py b/python/test/test_junit.py index 94312801..519880cb 100644 --- a/python/test/test_junit.py +++ b/python/test/test_junit.py @@ -11,6 +11,7 @@ test_files_path = pathlib.Path(__file__).parent / 'files' + class TestElement(Element): __test__ = False @@ -394,12 +395,17 @@ def test_parse_junit_xml_files_with_empty_file(self): )) def test_parse_junit_xml_files_with_non_xml_file(self): - result_file = str(test_files_path / 'non-xml.xml') + result_file = test_files_path / 'non-xml.xml' + result_filename = str(result_file) + expected_filename = ('file:/' + result_file.absolute().as_posix()) if result_file.drive else result_file.name self.assertEqual( - parse_junit_xml_files([result_file]), + parse_junit_xml_files([result_filename]), ParsedUnitTestResults( files=1, - errors=[ParseError(file=result_file, message="Start tag expected, '<' not found, line 1, column 1 (non-xml.xml, line 1)", line=None, column=None)], + errors=[ParseError(file=result_filename, + message=f"Start tag expected, '<' not found, line 1, column 1 ({expected_filename}, line 1)", + line=None, + column=None)], suites=0, suite_tests=0, suite_skipped=0, @@ -410,12 +416,17 @@ def test_parse_junit_xml_files_with_non_xml_file(self): )) def test_parse_junit_xml_files_with_corrupt_xml_file(self): - result_file = str(test_files_path / 'corrupt-xml.xml') + result_file = test_files_path / 'corrupt-xml.xml' + result_filename = str(result_file) + expected_filename = ('file:/' + result_file.absolute().as_posix()) if result_file.drive else result_file.name self.assertEqual( - parse_junit_xml_files([result_file]), + parse_junit_xml_files([result_filename]), ParsedUnitTestResults( files=1, - errors=[ParseError(file=result_file, message='Premature end of data in tag skipped line 9, line 11, column 22 (corrupt-xml.xml, line 11)', line=None, column=None)], + errors=[ParseError(file=result_filename, + message=f'Premature end of data in tag skipped line 9, line 11, column 22 ({expected_filename}, line 11)', + line=None, + column=None)], suites=0, suite_tests=0, suite_skipped=0,