diff --git a/python/publish_unit_test_results.py b/python/publish_unit_test_results.py index 8b00e293..a4ff8ee8 100644 --- a/python/publish_unit_test_results.py +++ b/python/publish_unit_test_results.py @@ -103,6 +103,7 @@ def main(settings: Settings, gha: GithubAction) -> None: logger.info(f'Available memory to read files: {avail_mem}') # log the progress + # https://github.com/EnricoMi/publish-unit-test-result-action/issues/304 with progress_logger(items=len(files), interval_seconds=10, progress_template='Read {progress} files in {time}', diff --git a/python/test/test_progress.py b/python/test/test_progress.py index 7f035556..2b331add 100644 --- a/python/test/test_progress.py +++ b/python/test/test_progress.py @@ -1,5 +1,5 @@ import unittest -from datetime import datetime +from datetime import datetime, timezone import mock @@ -32,7 +32,7 @@ def test(self): logger = mock.MagicMock(info=mock.Mock()) plogger = ProgressLogger(progress, 60, 'progress: {progress} in {time}', logger) try: - ts = datetime.fromisoformat('2022-06-01 12:34:56') + ts = datetime(2022, 6, 1, 12, 34, 56, tzinfo=timezone.utc) with mock.patch('publish.progress.datetime', utcnow=mock.Mock(return_value=ts)): plogger.start() logger.info.assert_not_called() @@ -40,7 +40,7 @@ def test(self): progress.observe('item') logger.info.assert_not_called() - ts = datetime.fromisoformat('2022-06-01 12:35:00') + ts = datetime(2022, 6, 1, 12, 35, 00, tzinfo=timezone.utc) with mock.patch('publish.progress.datetime', utcnow=mock.Mock(return_value=ts)): plogger._log_progress() self.assertEqual([mock.call('progress: 1 of 10 in 4 seconds')], logger.info.call_args_list) @@ -50,13 +50,13 @@ def test(self): progress.observe('item') logger.info.assert_not_called() - ts = datetime.fromisoformat('2022-06-01 12:40:00') + ts = datetime(2022, 6, 1, 12, 40, 00, tzinfo=timezone.utc) with mock.patch('publish.progress.datetime', utcnow=mock.Mock(return_value=ts)): plogger._log_progress() self.assertEqual([mock.call('progress: 3 of 10 in 5 minutes and 4 seconds')], logger.info.call_args_list) logger.info.reset_mock() finally: - ts = datetime.fromisoformat('2022-06-01 12:41:23') + ts = datetime(2022, 6, 1, 12, 41, 23, tzinfo=timezone.utc) with mock.patch('publish.progress.datetime', utcnow=mock.Mock(return_value=ts)): plogger.finish('finished: {observations} of {items} in {duration}') self.assertEqual([mock.call('finished: 3 of 10 in 6 minutes and 27 seconds')], logger.info.call_args_list)