Skip to content

fix: pass url as keyword argument to requests.post - #789

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/requests-post-url-kwarg
Open

fix: pass url as keyword argument to requests.post#789
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/requests-post-url-kwarg

Conversation

@sentry

@sentry sentry Bot commented Sep 12, 2026

Copy link
Copy Markdown

The KeyError: 'url' occurred in repro.py because the post() helper in codecov_cli/helpers/request.py was calling requests.post with the url as a positional argument. When mocking requests.post, this meant url was in call_args[0] (positional arguments) but not in call_kwargs (keyword arguments).

The repro.py script's logic c.kwargs["url"] if c.kwargs else c.args[0] would then fail if c.kwargs was non-empty (which it was, containing json, headers, params) but did not contain a url key.

This change modifies the post() helper to explicitly pass url=url as a keyword argument to requests.post. This ensures that url is always available in c.kwargs when requests.post is mocked, resolving the KeyError and making mock introspection more consistent.

Fixes CLI-H6

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
723 1 722 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 1726 times)

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 more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

0 participants