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

fix: accept tokenless value from branch instead of env var #475

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

joseph-sentry
Copy link
Contributor

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
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

4 similar comments
Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
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

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
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

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
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

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
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

Copy link

codecov bot commented Jul 15, 2024

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
3555 5 3550 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 more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

4 similar comments
Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 693 tests with 1 failed, 692 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

@joseph-sentry joseph-sentry force-pushed the joseph/fix-tokenless branch from b0dd421 to 691e159 Compare July 31, 2024 18:19
@joseph-sentry joseph-sentry requested a review from a team July 31, 2024 18:19
Copy link

❌ Failed Test Results:

Completed 694 tests with 1 failed, 693 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

4 similar comments
Copy link

❌ Failed Test Results:

Completed 694 tests with 1 failed, 693 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 694 tests with 1 failed, 693 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 694 tests with 1 failed, 693 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 694 tests with 1 failed, 693 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Comment on lines 48 to 52
tokenless = os.environ.get("TOKENLESS")
if tokenless:
if not token and branch and ":" in branch:
headers = None # type: ignore
branch = tokenless # type: ignore
logger.info("The PR is happening in a forked repo. Using tokenless upload.")
else:
headers = get_token_header_or_fail(token)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strictly speaking, we no longer need any of this logic anymore. we just send whatever we have for the token and the branch, and the API will return a 401 if it's not allowed

the logs may still be helpful, so maybe change to:

if not token:
    if branch and ":" in branch:
        logger.info("Creating a commit on an unprotected branch")
    else:
        logger.warning("Token is missing, but branch is missing or protected")

headers = get_token_header(token)

Copy link

github-actions bot commented Sep 4, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

4 similar comments
Copy link

github-actions bot commented Sep 4, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 4, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 4, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 4, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

1 similar comment
Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

2 similar comments
Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Sep 5, 2024

❌ Failed Test Results:

Completed 696 tests with 1 failed, 695 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 698 tests with 2 failed, 696 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
tests.services.commit.test_commit_service::test_commit_sender_with_forked_repo_bad_branch

Test name:
pytest
mocker = &lt;pytest_mock.plugin.MockerFixture object at 0x7fb05bbed2d0&gt;

def test_commit_sender_with_forked_repo_bad_branch(mocker):
mocked_response = mocker.patch(
&quot;codecov_cli.services.commit.send_post_request&quot;,
return_value=mocker.MagicMock(status_code=200, text=&quot;success&quot;),
)

&gt; _res = send_commit_data(
&quot;commit_sha&quot;,
&quot;parent_sha&quot;,
&quot;1&quot;,
&quot;branch&quot;,
&quot;codecov::::codecov-cli&quot;,
None,
&quot;github&quot;,
None,
)
E TypeError: send_commit_data() missing 1 required positional argument: &apos;args&apos;

.../services/commit/test_commit_service.py:185: TypeError
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 698 tests with 2 failed, 696 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
tests.services.commit.test_commit_service::test_commit_sender_with_forked_repo_bad_branch

Test name:
pytest
mocker = &lt;pytest_mock.plugin.MockerFixture object at 0x7fabce774760&gt;

def test_commit_sender_with_forked_repo_bad_branch(mocker):
mocked_response = mocker.patch(
&quot;codecov_cli.services.commit.send_post_request&quot;,
return_value=mocker.MagicMock(status_code=200, text=&quot;success&quot;),
)

&gt; _res = send_commit_data(
&quot;commit_sha&quot;,
&quot;parent_sha&quot;,
&quot;1&quot;,
&quot;branch&quot;,
&quot;codecov::::codecov-cli&quot;,
None,
&quot;github&quot;,
None,
)
E TypeError: send_commit_data() missing 1 required positional argument: &apos;args&apos;

.../services/commit/test_commit_service.py:185: TypeError
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 698 tests with 2 failed, 696 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError
Testsuite:
tests.services.commit.test_commit_service::test_commit_sender_with_forked_repo_bad_branch

Test name:
pytest
mocker = &lt;pytest_mock.plugin.MockerFixture object at 0x7f0ca09121b0&gt;

def test_commit_sender_with_forked_repo_bad_branch(mocker):
mocked_response = mocker.patch(
&quot;codecov_cli.services.commit.send_post_request&quot;,
return_value=mocker.MagicMock(status_code=200, text=&quot;success&quot;),
)

&gt; _res = send_commit_data(
&quot;commit_sha&quot;,
&quot;parent_sha&quot;,
&quot;1&quot;,
&quot;branch&quot;,
&quot;codecov::::codecov-cli&quot;,
None,
&quot;github&quot;,
None,
)
E TypeError: send_commit_data() missing 1 required positional argument: &apos;args&apos;

.../services/commit/test_commit_service.py:185: TypeError

Copy link

❌ Failed Test Results:

Completed 698 tests with 1 failed, 697 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

2 similar comments
Copy link

❌ Failed Test Results:

Completed 698 tests with 1 failed, 697 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

❌ Failed Test Results:

Completed 698 tests with 1 failed, 697 passed and 0 skipped.

View the full list of failed tests
Test Description Failure message
Testsuite:
api.temp.calculator.test_calculator::test_divide

Test name:
pytest
def
test_divide():
&gt; assert Calculator.divide(1, 2) == 0.5
E assert 1.0 == 0.5
E + where 1.0 = &lt;function Calculator.divide at 0x104c9eb90&gt;(1, 2)
E + where &lt;function Calculator.divide at 0x104c9eb90&gt; = Calculator.divide
.../temp/calculator/test_calculator.py:30: AssertionError

Copy link

github-actions bot commented Dec 3, 2024

✅ All tests successful. No failed tests were found.

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

Copy link
Contributor

@matt-codecov matt-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the whiplash :(

logger.info("The PR is happening in a forked repo. Using tokenless upload.")
else:
headers = get_token_header(token)
headers = get_token_header(token)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently the GHA pulls the latest codecovcli by default, so users who are still on older versions of the action which use $TOKENLESS will find themselves suddenly broken if we release this version that stops reading from it

so i guess we should still read from the env var, and i think logs would be valuable if they get printed to the user so they can see hints that maybe their branch name is not what they expected

# Old versions of the GHA use this env var instead of the regular branch
# argument to provide an unprotected branch name
if tokenless := os.environ.get("TOKENLESS"):
  branch = tokenless

if branch and ":" in branch:
    logger.info(f"Creating a commit for an unprotected branch: {branch}")
elif token is None:
    logger.warning(f"Branch `{branch}` is protected but no token was provided\nFor information on Codecov upload tokens, see https://docs.codecov.com/docs/codecov-tokens")
else:
    logger.info("Using token to create a commit for protected branch `{branch}`")

headers = get_token_header(token)

@joseph-sentry joseph-sentry merged commit ceeaddc into main Dec 3, 2024
21 checks passed
@joseph-sentry joseph-sentry deleted the joseph/fix-tokenless branch December 3, 2024 22:05
# Old versions of the GHA use this env var instead of the regular branch
# argument to provide an unprotected branch name
if tokenless := os.environ.get("TOKENLESS"):
branch = tokenless
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

branch = os.environ.get("TOKENLESS", None) could have worked too

Copy link
Contributor

@matt-codecov matt-codecov Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would clobber whatever was already in branch. we want that value, unless there is a value in $TOKENLESS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matt-codecov ahhh that's a good point

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.

Tweak how CLI gets the branch name for tokenless
5 participants