Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test-results-parser #524

Merged
merged 2 commits into from
Oct 9, 2024
Merged

Conversation

michelletran-codecov
Copy link
Contributor

@michelletran-codecov michelletran-codecov commented Oct 8, 2024

This will format the message to the newest latest version for the CLI tooling.

Copy link

codecov bot commented Oct 8, 2024

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
3485 5 3480 0
View the top 3 failed tests by shortest run time
api.temp.calculator.test_calculator test_divide
Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError
api.temp.calculator.test_calculator test_divide
Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError
api.temp.calculator.test_calculator test_divide
Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@michelletran-codecov michelletran-codecov force-pushed the update_test_results_parser branch from fade056 to 0a75827 Compare October 8, 2024 16:54
Copy link

github-actions bot commented Oct 8, 2024

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
3465 5 3460 0
View the top 3 failed tests by shortest run time
test_process_test_results
Stack Traces | 0.052s run time
self = <MagicMock name='send_post_request' id='139883249547152'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f391b694d60>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E             Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/mock.py:939: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7f391b68efd0>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E         Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this repor...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E         -                   '\n'
E         +                   'were found.\n'
E         ?                    +++++++++++
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.059s run time
self = <MagicMock name='send_post_request' id='140277170110816'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f94d2f46320>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/unittest/mock.py:929: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7f94d2fcb910>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this repor...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E         -                   '\n'
E         +                   'were found.\n'
E         ?                    +++++++++++
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.067s run time
self = <MagicMock name='send_post_request' id='140517840210240'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7fccdbfaa670>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/unittest/mock.py:907: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7fccdbf34e20>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n:mega: Thoughts on this repor...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E         -                   '\n'
E         +                   'were found.\n'
E         ?                    +++++++++++
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
📣 Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)

@michelletran-codecov michelletran-codecov force-pushed the update_test_results_parser branch from 0a75827 to 40c3ef9 Compare October 8, 2024 19:40
Copy link

github-actions bot commented Oct 8, 2024

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
2079 3 2076 0
View the top 3 failed tests by shortest run time
test_process_test_results
Stack Traces | 0.049s run time
self = <MagicMock name='send_post_request' id='139775658190480'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f200e8a8720>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E             Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/mock.py:939: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7f200e7614d0>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E         Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.063s run time
self = <MagicMock name='send_post_request' id='139913984984928'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = ((), {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\...hatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f4043633e50>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher((args, kwargs))
        actual = self._call_matcher(self.call_args)
        if expected != actual:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/mock.py:913: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7f4043502b20>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.065s run time
self = <MagicMock name='send_post_request' id='140556807557280'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7fd5ee9e9430>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/unittest/mock.py:907: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5ee9445b0>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Copy link

github-actions bot commented Oct 8, 2024

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
3465 5 3460 0
View the top 3 failed tests by shortest run time
test_process_test_results
Stack Traces | 0.048s run time
self = <MagicMock name='send_post_request' id='140458206800080'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7fbef99bc720>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E             Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/mock.py:939: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7fbef9859510>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E         Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.063s run time
self = <MagicMock name='send_post_request' id='140415355713856'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \n...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7fb4ff857be0>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/unittest/mock.py:929: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7fb4ff604280>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError
test_process_test_results
Stack Traces | 0.066s run time
self = <MagicMock name='send_post_request' id='140179124261360'>, args = ()
kwargs = {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...whatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'}
expected = ((), {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\...hatever', 'X-GitHub-Api-Version': '2022-11-28'}, 'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments'})
actual = call(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests su...rs={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f7dfef2ee50>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher((args, kwargs))
        actual = self._call_matcher(self.call_args)
        if expected != actual:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E           Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/mock.py:913: AssertionError

During handling of the above exception, another exception occurred:

mocker = <pytest_mock.plugin.MockerFixture object at 0x7f7dfeed3850>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_process_test_results0')

    def test_process_test_results(
        mocker,
        tmpdir,
    ):
    
        tmp_file = tmpdir.mkdir("folder").join("summary.txt")
    
        mocker.patch.dict(
            os.environ,
            {
                "GITHUB_REPOSITORY": "fake/repo",
                "GITHUB_REF": "pull/fake/pull",
                "GITHUB_STEP_SUMMARY": tmp_file.dirname + tmp_file.basename,
            },
        )
        mocked_post = mocker.patch(
            "codecov_cli.commands.process_test_results.send_post_request",
            return_value=RequestResult(
                status_code=200, error=None, warnings=[], text="yay it worked"
            ),
        )
        runner = CliRunner()
        result = runner.invoke(
            cli,
            [
                "process-test-results",
                "--provider-token",
                "whatever",
                "--file",
                "samples/junit.xml",
                "--disable-search",
            ],
            obj={},
        )
    
        assert result.exit_code == 0
    
>       mocked_post.assert_called_with(
            url="https://api.github.com/repos/fake/repo/issues/pull/comments",
            data={
                "body": "### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |",
                "cli_args": {
                    "auto_load_params_from": None,
                    "codecov_yml_path": None,
                    "enterprise_url": None,
                    "verbose": False,
                    "version": f"cli-{__version__}",
                    "command": "process-test-results",
                    "provider_token": "whatever",
                    "disable_search": True,
                    "dir": os.getcwd(),
                    "exclude_folders": (),
                },
            },
            headers={
                "Accept": "application/vnd.github+json",
                "Authorization": "Bearer whatever",
                "X-GitHub-Api-Version": "2022-11-28",
            },
        )
E       AssertionError: expected call not found.
E       Expected: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<details><summary>View the full list of failed tests</summary>\n\n| **Test Description** | **Failure message** |\n| :-- | :-- |\n| <pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test name:<br>pytest<br></pre> | <pre>def<br>                test_divide():<br>                > assert Calculator.divide(1, 2) == 0.5<br>                E assert 1.0 == 0.5<br>                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)<br>                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide<br>                .../temp/calculator/test_calculator.py:30: AssertionError</pre> |', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       Actual: send_post_request(url='https://api.github.com/repos/fake/repo/issues/pull/comments', data={'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this report? [Let Codecov know!](https://github.com/codecov/feedback/issues/304) | Powered by [Codecov](https://about.codecov.io/)', 'cli_args': {'auto_load_params_from': None, 'codecov_yml_path': None, 'enterprise_url': None, 'verbose': False, 'version': 'cli-0.7.5', 'command': 'process-test-results', 'provider_token': 'whatever', 'disable_search': True, 'dir': '/home/runner/work/codecov-cli/codecov-cli', 'exclude_folders': ()}}, headers={'Accept': 'application/vnd.github+json', 'Authorization': 'Bearer whatever', 'X-GitHub-Api-Version': '2022-11-28'})
E       
E       pytest introspection follows:
E       
E       Kwargs:
E       assert {'data': {'bo...ull/comments'} == {'data': {'bo...ull/comments'}
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'data': {'body': ':white_check_mark: All tests successful. No failed tests were found.\n\n:mega: Thoughts on this rep...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}} != {'data': {'body': '### :x: Failed Test Results: \nCompleted 4 tests with **`1 failed`**, 3 passed and 0 skipped.\n<det...'codecov_yml_path': None, 'command': 'process-test-results', 'dir': '/home/runner/work/codecov-cli/codecov-cli', ...}}}
E         Full diff:
E           {
E         +  'data': {'body': ':white_check_mark: All tests successful. No failed tests '
E         -  'data': {'body': '### :x: Failed Test Results: \n'
E         -                   'Completed 4 tests with **`1 failed`**, 3 passed and 0 '
E         -                   'skipped.\n'
E         ?                    ^^^^^
E         +                   'were found.\n'
E         ?                    ^ +++++++
E         -                   '<details><summary>View the full list of failed '
E         -                   'tests</summary>\n'
E                             '\n'
E         +                   ':mega: Thoughts on this report? [Let Codecov '
E         +                   'know!](https://github.com/codecov/feedback/issues/304) | '
E         +                   'Powered by [Codecov](https://about.codecov.io/)',
E         -                   '| **Test Description** | **Failure message** |\n'
E         -                   '| :-- | :-- |\n'
E         -                   '| '
E         -                   '<pre>Testsuite:<br>api.temp.calculator.test_calculator::test_divide<br><br>Test '
E         -                   'name:<br>pytest<br></pre> | <pre>def<br>                '
E         -                   'test_divide():<br>                > assert '
E         -                   'Calculator.divide(1, 2) == 0.5<br>                E assert '
E         -                   '1.0 == 0.5<br>                E + where 1.0 = '
E         -                   '<function Calculator.divide at '
E         -                   '0x104c9eb90>(1, 2)<br>                E + where '
E         -                   '<function Calculator.divide at 0x104c9eb90> = '
E         -                   'Calculator.divide<br>                '
E         -                   '.../temp/calculator/test_calculator.py:30: '
E         -                   'AssertionError</pre> |',
E                     'cli_args': {'auto_load_params_from': None,
E                                  'codecov_yml_path': None,
E                                  'command': 'process-test-results',
E                                  'dir': '/home/runner/work/codecov-cli/codecov-cli',
E                                  'disable_search': True,
E                                  'enterprise_url': None,
E                                  'exclude_folders': (),
E                                  'provider_token': 'whatever',
E                                  'verbose': False,
E                                  'version': 'cli-0.7.5'}},
E            'headers': {'Accept': 'application/vnd.github+json',
E                        'Authorization': 'Bearer whatever',
E                        'X-GitHub-Api-Version': '2022-11-28'},
E            'url': 'https://api.github.com/repos/fake/repo/issues/pull/comments',
E           }

tests/commands/test_process_test_results.py:48: AssertionError

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@michelletran-codecov michelletran-codecov marked this pull request as ready for review October 8, 2024 19:51
@michelletran-codecov
Copy link
Contributor Author

This is ready for review, as it's only scoped to updating the format. It will also need #522 to overwrite existing message.

@michelletran-codecov michelletran-codecov requested review from a team and removed request for a team October 8, 2024 19:53
This will include the new formatted comment
@michelletran-codecov michelletran-codecov force-pushed the update_test_results_parser branch from 40c3ef9 to f8e17a3 Compare October 8, 2024 19:56
Copy link

github-actions bot commented Oct 8, 2024

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@michelletran-codecov michelletran-codecov requested a review from a team October 8, 2024 19:58
Swatinem
Swatinem previously approved these changes Oct 9, 2024
Since the tests are running on the "official" version of the CLI,
it is failing for any interface changes between the official version
and the version currently in review. So, changing it to also use the
local CLI for running the tests.
Copy link

github-actions bot commented Oct 9, 2024

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@michelletran-codecov michelletran-codecov requested a review from a team October 9, 2024 16:06
@michelletran-codecov michelletran-codecov merged commit a22eaf0 into main Oct 9, 2024
20 checks passed
@michelletran-codecov michelletran-codecov deleted the update_test_results_parser branch October 9, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants