-
Notifications
You must be signed in to change notification settings - Fork 4k
chore: Remove usage of deprecated assertDictContainsSubset
unittest method.
#34330
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
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! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
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
@feanil would this PR be helpful for the python 3.12 upgrade? |
yes, we'll have to do it before we move edx-platform to Python 3.12 |
Yea, if they can update the PR to resolve conflicts, I'm happy to review and land the PR. |
Awesome, thank you! @lewisemm - are you still interested in contributing this fix? If so it just needs to be updated to resolve conflicts. |
@sarina - Yes, I'm still interested in contributing this fix. Hoping I can find some time to go over this within the next one week. Does that work with your release timelines? |
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.