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

DM-33347: Fix compatibility with moto 3.0 #636

Merged
merged 1 commit into from Jan 21, 2022
Merged

DM-33347: Fix compatibility with moto 3.0 #636

merged 1 commit into from Jan 21, 2022

Conversation

timj
Copy link
Member

@timj timj commented Jan 21, 2022

moto3 broke the s3 tests solely in test_butler.py. It seems
that something has changed in using the mock_s3 class decorator
such that the inherited methods (the ones that are doing all
the testing) are not actually using the mocks at all but are
using raw boto. Moving the start and stop calls explicitly
into setUp and tearDown fixes the problem.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

moto3 broke the s3 tests solely in test_butler.py. It seems
that something has changed in using the mock_s3 class decorator
such that the inherited methods (the ones that are doing all
the testing) are not actually using the mocks at all but are
using raw boto. Moving the start and stop calls explicitly
into setUp and tearDown fixes the problem.
@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #636 (965d482) into main (b31a2de) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #636   +/-   ##
=======================================
  Coverage   84.13%   84.13%           
=======================================
  Files         237      237           
  Lines       30214    30216    +2     
  Branches     5022     5022           
=======================================
+ Hits        25421    25423    +2     
  Misses       3648     3648           
  Partials     1145     1145           
Impacted Files Coverage Δ
tests/test_butler.py 97.70% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9aeb7c1...965d482. Read the comment docs.

@timj timj requested a review from ktlim January 21, 2022 18:50
@@ -1590,7 +1590,6 @@ def setUp(self):


@unittest.skipIf(not boto3, "Warning: boto3 AWS SDK not found!")
@mock_s3
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it follows the documentation, but it's a little unclear how inherited tests are handled.

Since this code works, I guess it's OK.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the exact same mocking works fine in the resources package but that doesn't inherit tests from another class.

@timj timj merged commit 19f9d62 into main Jan 21, 2022
@timj timj deleted the tickets/DM-33347 branch January 21, 2022 20:54
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.

None yet

2 participants