Skip to content

fix: correct empty-upload test for create_commit options#717

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-ex-empty-upload-test
Open

fix: correct empty-upload test for create_commit options#717
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-ex-empty-upload-test

Conversation

@sentry

@sentry sentry Bot commented Jun 11, 2026

Copy link
Copy Markdown

This PR addresses issue CLI-EX, an AssertionError in a test that expected create_commit_logic to be called during an empty-upload command invocation.

The root cause was identified as an invalid CLI invocation within the test itself. The test was passing arguments to the empty-upload command that Click (the CLI framework) did not recognize or were missing required parameters (like --commit-sha). This caused Click to exit with a UsageError (exit code 2) before the command's logic, including the call to create_commit_logic, could ever execute.

To fix this, a new test test_invoke_empty_upload_send_commit_data_called_with_options has been added to tests/commands/test_invoke_empty_upload.py. This test:

  • Correctly patches send_commit_data at its actual import path (codecov_cli.services.commit.send_commit_data).
  • Provides all necessary and valid CLI arguments to empty-upload, including a valid --commit-sha and other create-commit related options (--parent-sha, --branch, --pr).
  • Mocks the CI adapter to ensure the test is self-contained and doesn't rely on environment variables for commit SHA resolution.
  • Asserts that send_commit_data is called with the expected arguments, confirming the empty-upload command correctly triggers commit creation with the provided options.

This change ensures that the intended functionality of empty-upload calling create_commit_logic is properly tested without encountering CLI argument parsing errors.

Fixes CLI-EX

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
701 1 700 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 214 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

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