-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore: Remove usage of deprecated assertDictContainsSubset
unittest method.
#34330
base: master
Are you sure you want to change the base?
chore: Remove usage of deprecated assertDictContainsSubset
unittest method.
#34330
Conversation
Thanks for the pull request, @lewisemm! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
Hi @lewisemm! Just flagging that there are a few failing tests. |
@mphilbrick211 Thanks for the nudge. Please allow me to convert this to draft as I figure out how to best fix those tests. Also, if you can send help my way that would be greatly appreciated. |
Sounds good, @lewisemm! I'll look into getting you some help! |
self.assertTrue( | ||
duplicated_event.items() <= event_receiver.call_args.kwargs.items() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can do:
assert duplicated_event.items() <= event_receiver.call_args.kwargs.items()
Or
self.assertLessEqual(duplicated_event.items(), event_receiver.call_args.kwargs.items())
But trying use assertTrue
here will cause pylint to flag it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfect. I'll make those changes. Thank you.
@mphilbrick211 Thanks. I got the help and I'll try to get this ready by end of week. |
bf190f2
to
062d941
Compare
Fixes 1 deprecation warning from test runs on the cms-1 shard.
Fixes 1 deprecation warning from cms-2 test runs.
Fix 3 deprecation warnings from test runs on common-with-cms shard.
Fix 7 deprecation warnings from test runs on common-with-lms shard.
Fix 4 deprecation warnings from test runs on lms-1 shard.
Fix 10 deprecation warnings from test runs on lms-3 shard.
Fix 6 deprecation warnings from test runs on lms-4 shard.
Fix 1 deprecation warning from test runs on lms-5 shard.
Fix 77 deprecation warnings from test runs on lms-6 shard.
Fix 10 deprecation warnings from test runs on openedx-1-with-cms shard.
Fix 2 deprecation warnings from test runs on openedx-1-with-lms shard.
Fix 16 deprecation warnings from test runs on openedx-2-with-cms shard.
Fix 30 deprecation warnings from test runs on openedx-2-with-lms shard.
Fix 3 deprecation warnings from test runs on xmodule-with-cms shard.
Use assertLessEqual method to compare dictionary subset overlap. This replaces the use of `assertTrue(dict1.items() <= dict2.items())` format which raises pylint errors.
062d941
to
e479208
Compare
Description
assertDictContainsSubset
has been deprecated since Python 3.2 and was removed in Python 3.12.This PR removes all usage of
assertDictContainsSubset
and uses the set operator,<=
, on dictionary methoditems()
for subset comparisons.Supporting information
openedx/public-engineering#90
Testing instructions
Please provide detailed step-by-step instructions for testing this change.
Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Include anything else that will help reviewers and consumers understand the change.