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

re-export shared bot exceptions instead of redefining them #598

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

matt-codecov
Copy link
Contributor

@matt-codecov matt-codecov commented Aug 7, 2024

worker copy/pastes the definitions of exception types that live in shared now. worker code tries to catch the worker redefinitions, but shared is throwing the original shared definitions. even though they're named/defined identically, they're totally unrelated types. so the exceptions aren't caught

i added a unit test for the specific case i saw where an exception was not getting caught. there may be others

@matt-codecov matt-codecov requested a review from a team August 7, 2024 23:31
@matt-codecov matt-codecov changed the title re-export shared bot exceptions instead of redefine them re-export shared bot exceptions instead of redefining them Aug 7, 2024
@codecov-notifications
Copy link

codecov-notifications bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files Patch % Lines
tasks/tests/unit/test_preprocess_upload.py 85.71% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
- Coverage   97.57%   97.56%   -0.01%     
==========================================
  Files         429      429              
  Lines       35951    35958       +7     
==========================================
+ Hits        35079    35084       +5     
- Misses        872      874       +2     
Flag Coverage Δ
integration 97.56% <89.47%> (-0.01%) ⬇️
latest-uploader-overall 97.56% <89.47%> (-0.01%) ⬇️
unit 97.56% <89.47%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.72% <100.00%> (-0.01%) ⬇️
OutsideTasks 97.80% <100.00%> (-0.01%) ⬇️
Files Coverage Δ
helpers/exceptions.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_preprocess_upload.py 97.77% <85.71%> (-2.23%) ⬇️

@codecov-qa
Copy link

codecov-qa bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.56%. Comparing base (1357214) to head (755f415).

✅ All tests successful. No failed tests found.

Files Patch % Lines
tasks/tests/unit/test_preprocess_upload.py 85.71% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
- Coverage   97.57%   97.56%   -0.01%     
==========================================
  Files         429      429              
  Lines       35951    35958       +7     
==========================================
+ Hits        35079    35084       +5     
- Misses        872      874       +2     
Flag Coverage Δ
integration 97.56% <89.47%> (-0.01%) ⬇️
latest-uploader-overall 97.56% <89.47%> (-0.01%) ⬇️
unit 97.56% <89.47%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.72% <100.00%> (-0.01%) ⬇️
OutsideTasks 97.80% <100.00%> (-0.01%) ⬇️
Files Coverage Δ
helpers/exceptions.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_preprocess_upload.py 97.77% <85.71%> (-2.23%) ⬇️

Copy link

codecov-public-qa bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.56%. Comparing base (1357214) to head (755f415).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
- Coverage   97.57%   97.56%   -0.01%     
==========================================
  Files         429      429              
  Lines       35951    35958       +7     
==========================================
+ Hits        35079    35084       +5     
- Misses        872      874       +2     
Flag Coverage Δ
integration 97.56% <89.47%> (-0.01%) ⬇️
latest-uploader-overall 97.56% <89.47%> (-0.01%) ⬇️
unit 97.56% <89.47%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.72% <100.00%> (-0.01%) ⬇️
OutsideTasks 97.80% <100.00%> (-0.01%) ⬇️
Files Coverage Δ
helpers/exceptions.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_preprocess_upload.py 97.77% <85.71%> (-2.23%) ⬇️

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.61%. Comparing base (1357214) to head (755f415).

✅ All tests successful. No failed tests found.

Files Patch % Lines
tasks/tests/unit/test_preprocess_upload.py 85.71% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
- Coverage   97.61%   97.61%   -0.01%     
==========================================
  Files         464      464              
  Lines       37157    37164       +7     
==========================================
+ Hits        36271    36276       +5     
- Misses        886      888       +2     
Flag Coverage Δ
integration 97.56% <89.47%> (-0.01%) ⬇️
latest-uploader-overall 97.56% <89.47%> (-0.01%) ⬇️
unit 97.56% <89.47%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.80% <100.00%> (-0.01%) ⬇️
OutsideTasks 97.80% <100.00%> (-0.01%) ⬇️
Files Coverage Δ
helpers/exceptions.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_preprocess_upload.py 97.77% <85.71%> (-2.23%) ⬇️

This change has been scanned for critical changes. Learn more

Comment on lines +224 to +227
mock_owner_bot = mocker.patch(
"shared.bots.repo_bots.get_owner_or_appropriate_bot"
)
mock_owner_bot.side_effect = OwnerWithoutValidBotError()
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically this mock returns the locally imported helpers.exceptions.OwnerWithoutValidBotError, which could still exhibit the same problem (as in: being a different type from shared.bots.exceptions.OwnerWithoutValidBotError)

Copy link
Contributor Author

@matt-codecov matt-codecov Aug 8, 2024

Choose a reason for hiding this comment

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

this is a "gotcha" for mocking (if foo.py does from bar import baz, you have to mock foo.baz instead of bar.baz), but from what i was reading python still understands OwnerWithoutValidBotError is the same type regardless of the import path

@matt-codecov matt-codecov added this pull request to the merge queue Aug 8, 2024
Merged via the queue into main with commit 4752695 Aug 8, 2024
24 of 27 checks passed
@matt-codecov matt-codecov deleted the pr598 branch August 8, 2024 16:29
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