Rework structure of CI workflow #1130
6 fail, 416 pass in 52m 23s
Annotations
Check warning on line 1138 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_main (python.test.test_action_script.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 731 != 735
self = <test_action_script.Test testMethod=test_main>
def test_main(self):
with tempfile.TemporaryDirectory() as path:
filepath = os.path.join(path, 'file')
with open(filepath, 'wt', encoding='utf-8') as file:
file.write('{}')
gha = mock.MagicMock()
settings = get_settings(dict(
COMMIT='commit',
GITHUB_TOKEN='********',
GITHUB_EVENT_PATH=file.name,
GITHUB_EVENT_NAME='push',
GITHUB_REPOSITORY='repo',
EVENT_FILE=None,
FILES='\n'.join(str(path) for path in [test_files_path / '**' / '*.xml',
test_files_path / '**' / '*.trx',
test_files_path / '**' / '*.json']),
JUNIT_FILES=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
NUNIT_FILES=str(test_files_path / 'nunit' / '**' / '*.xml'),
XUNIT_FILES=str(test_files_path / 'xunit' / '**' / '*.xml'),
TRX_FILES=str(test_files_path / 'trx' / '**' / '*.trx'),
REPORT_SUITE_LOGS='info'
), gha)
with mock.patch('publish_test_results.get_github'), \
mock.patch('publish.publisher.Publisher.publish') as m:
main(settings, gha)
# Publisher.publish is expected to have been called once
self.assertEqual(1, len(m.call_args_list))
self.assertEqual(3, len(m.call_args_list[0].args))
# Publisher.publish is expected to have been called with these arguments
results, cases, conclusion = m.call_args_list[0].args
self.assertEqual(145, results.files)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and below Python 3.9 we see one particular error
> self.assertEqual(731, results.suites)
E AssertionError: 731 != 735
test_action_script.py:1176: AssertionError
Check warning on line 956 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_parse_files (python.test.test_action_script.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 17 != 13
self = <test_action_script.Test testMethod=test_parse_files>
def test_parse_files(self):
gha = mock.MagicMock()
settings = self.get_settings(files_glob='\n'.join([str(test_files_path / '**' / '*.xml'), str(test_files_path / '**' / '*.trx'), str(test_files_path / '**' / '*.json')]),
junit_files_glob=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
nunit_files_glob=str(test_files_path / 'nunit' / '**' / '*.xml'),
xunit_files_glob=str(test_files_path / 'xunit' / '**' / '*.xml'),
trx_files_glob=str(test_files_path / 'trx' / '**' / '*.trx'))
with mock.patch('publish_test_results.logger') as l:
actual = parse_files(settings, gha)
for call in l.info.call_args_list:
print(call.args[0])
self.assertEqual(17, len(l.info.call_args_list))
self.assertTrue(any([call.args[0].startswith(f"Reading files {prettify_glob_pattern(settings.files_glob)} (76 files, ") for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading JUnit XML files {prettify_glob_pattern(settings.junit_files_glob)} (28 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading NUnit XML files {prettify_glob_pattern(settings.nunit_files_glob)} (24 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading XUnit XML files {prettify_glob_pattern(settings.xunit_files_glob)} (8 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading TRX files {prettify_glob_pattern(settings.trx_files_glob)} (9 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 27 JUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 24 NUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 8 XUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 9 TRX files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 1 Dart JSON file (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 1 Mocha JSON file (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 4 unsupported files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Unsupported file: ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}xml{os.sep}non-xml.xml') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}junit-xml{os.sep}non-junit.xml') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}json{os.sep}non-json.json') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}json{os.sep}malformed-json.json') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Finished reading 145 files in ') for call in l.info.call_args_list]))
for call in l.debug.call_args_list:
print(call.args[0])
self.assertEqual(11, len(l.debug.call_args_list))
self.assertTrue(any([call.args[0].startswith('reading files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading JUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading NUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading XUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading TRX files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected JUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected NUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected XUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected TRX files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected Dart JSON files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected Mocha JSON files [') for call in l.debug.call_args_list]))
self.assertEqual([], gha.method_calls)
self.assertEqual(145, actual.files)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and below Python 3.9 we see one particular error
> self.assertEqual(17, len(actual.errors))
E AssertionError: 17 != 13
test_action_script.py:1011: AssertionError
Check warning on line 1074 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_parse_files_with_suite_details (python.test.test_action_script.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 363 != 365
self = <test_action_script.Test testMethod=test_parse_files_with_suite_details>
def test_parse_files_with_suite_details(self):
for options in [
{'report_suite_out_logs': True, 'report_suite_err_logs': False},
{'report_suite_out_logs': False, 'report_suite_err_logs': True},
{'report_suite_out_logs': True, 'report_suite_err_logs': True},
{'json_suite_details': True}
]:
with self.subTest(**options):
gha = mock.MagicMock()
settings = self.get_settings(junit_files_glob=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
nunit_files_glob=str(test_files_path / 'nunit' / '**' / '*.xml'),
xunit_files_glob=str(test_files_path / 'xunit' / '**' / '*.xml'),
trx_files_glob=str(test_files_path / 'trx' / '**' / '*.trx'),
**options)
actual = parse_files(settings, gha)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and Python below 3.9 we see one particular error
> self.assertEqual(363, len(actual.suite_details))
E AssertionError: 363 != 365
test_action_script.py:1093: AssertionError
Check warning on line 1138 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_main (python.test.test_junit.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 731 != 735
self = <test_action_script.Test testMethod=test_main>
def test_main(self):
with tempfile.TemporaryDirectory() as path:
filepath = os.path.join(path, 'file')
with open(filepath, 'wt', encoding='utf-8') as file:
file.write('{}')
gha = mock.MagicMock()
settings = get_settings(dict(
COMMIT='commit',
GITHUB_TOKEN='********',
GITHUB_EVENT_PATH=file.name,
GITHUB_EVENT_NAME='push',
GITHUB_REPOSITORY='repo',
EVENT_FILE=None,
FILES='\n'.join(str(path) for path in [test_files_path / '**' / '*.xml',
test_files_path / '**' / '*.trx',
test_files_path / '**' / '*.json']),
JUNIT_FILES=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
NUNIT_FILES=str(test_files_path / 'nunit' / '**' / '*.xml'),
XUNIT_FILES=str(test_files_path / 'xunit' / '**' / '*.xml'),
TRX_FILES=str(test_files_path / 'trx' / '**' / '*.trx'),
REPORT_SUITE_LOGS='info'
), gha)
with mock.patch('publish_test_results.get_github'), \
mock.patch('publish.publisher.Publisher.publish') as m:
main(settings, gha)
# Publisher.publish is expected to have been called once
self.assertEqual(1, len(m.call_args_list))
self.assertEqual(3, len(m.call_args_list[0].args))
# Publisher.publish is expected to have been called with these arguments
results, cases, conclusion = m.call_args_list[0].args
self.assertEqual(145, results.files)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and below Python 3.9 we see one particular error
> self.assertEqual(731, results.suites)
E AssertionError: 731 != 735
test_action_script.py:1176: AssertionError
Check warning on line 956 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_parse_files (python.test.test_junit.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 17 != 13
self = <test_action_script.Test testMethod=test_parse_files>
def test_parse_files(self):
gha = mock.MagicMock()
settings = self.get_settings(files_glob='\n'.join([str(test_files_path / '**' / '*.xml'), str(test_files_path / '**' / '*.trx'), str(test_files_path / '**' / '*.json')]),
junit_files_glob=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
nunit_files_glob=str(test_files_path / 'nunit' / '**' / '*.xml'),
xunit_files_glob=str(test_files_path / 'xunit' / '**' / '*.xml'),
trx_files_glob=str(test_files_path / 'trx' / '**' / '*.trx'))
with mock.patch('publish_test_results.logger') as l:
actual = parse_files(settings, gha)
for call in l.info.call_args_list:
print(call.args[0])
self.assertEqual(17, len(l.info.call_args_list))
self.assertTrue(any([call.args[0].startswith(f"Reading files {prettify_glob_pattern(settings.files_glob)} (76 files, ") for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading JUnit XML files {prettify_glob_pattern(settings.junit_files_glob)} (28 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading NUnit XML files {prettify_glob_pattern(settings.nunit_files_glob)} (24 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading XUnit XML files {prettify_glob_pattern(settings.xunit_files_glob)} (8 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Reading TRX files {prettify_glob_pattern(settings.trx_files_glob)} (9 files, ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 27 JUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 24 NUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 8 XUnit XML files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 9 TRX files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 1 Dart JSON file (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 1 Mocha JSON file (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Detected 4 unsupported files (') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Unsupported file: ') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}xml{os.sep}non-xml.xml') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}junit-xml{os.sep}non-junit.xml') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}json{os.sep}non-json.json') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].endswith(f'python{os.sep}test{os.sep}files{os.sep}json{os.sep}malformed-json.json') for call in l.info.call_args_list]))
self.assertTrue(any([call.args[0].startswith(f'Finished reading 145 files in ') for call in l.info.call_args_list]))
for call in l.debug.call_args_list:
print(call.args[0])
self.assertEqual(11, len(l.debug.call_args_list))
self.assertTrue(any([call.args[0].startswith('reading files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading JUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading NUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading XUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('reading TRX files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected JUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected NUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected XUnit XML files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected TRX files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected Dart JSON files [') for call in l.debug.call_args_list]))
self.assertTrue(any([call.args[0].startswith('detected Mocha JSON files [') for call in l.debug.call_args_list]))
self.assertEqual([], gha.method_calls)
self.assertEqual(145, actual.files)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and below Python 3.9 we see one particular error
> self.assertEqual(17, len(actual.errors))
E AssertionError: 17 != 13
test_action_script.py:1011: AssertionError
Check warning on line 1074 in python/test/test_action_script.py
github-actions / Test Results (Windows python installed)
1 out of 130 runs failed: test_parse_files_with_suite_details (python.test.test_junit.Test)
artifacts\Test Results (python-3.8, macos-13)\test-results\pytest.xml [took 0s]
Raw output
AssertionError: 363 != 365
self = <test_action_script.Test testMethod=test_parse_files_with_suite_details>
def test_parse_files_with_suite_details(self):
for options in [
{'report_suite_out_logs': True, 'report_suite_err_logs': False},
{'report_suite_out_logs': False, 'report_suite_err_logs': True},
{'report_suite_out_logs': True, 'report_suite_err_logs': True},
{'json_suite_details': True}
]:
with self.subTest(**options):
gha = mock.MagicMock()
settings = self.get_settings(junit_files_glob=str(test_files_path / 'junit-xml' / '**' / '*.xml'),
nunit_files_glob=str(test_files_path / 'nunit' / '**' / '*.xml'),
xunit_files_glob=str(test_files_path / 'xunit' / '**' / '*.xml'),
trx_files_glob=str(test_files_path / 'trx' / '**' / '*.trx'),
**options)
actual = parse_files(settings, gha)
if Version(sys.version.split(' ')[0]) < Version('3.9.0') and sys.platform.startswith('darwin'):
# on macOS and Python below 3.9 we see one particular error
> self.assertEqual(363, len(actual.suite_details))
E AssertionError: 363 != 365
test_action_script.py:1093: AssertionError