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

[tests] Test Failures with Python 3.12: assertDictContainsSubset and assertEquals Deprecation #953

Open
dee077 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #954
Open

[tests] Test Failures with Python 3.12: assertDictContainsSubset and assertEquals Deprecation #953

dee077 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #954

Comments

@dee077
Copy link
Contributor

dee077 commented Dec 23, 2024

Summary:

Tests in OpenWISP Controller fail on Python 3.12 due to:

  1. Removal of assertDictContainsSubset.
  2. Deprecation of assertEquals (now replaced by assertEqual).

Steps to Reproduce:

  1. Set up OpenWISP Controller and install dependencies.
  2. Run tests with Python 3.12.
  3. Two test failures:
    • assertDictContainsSubset in test_context_regression.
    • assertEquals in test_ip_fields_not_duplicated.

Expected Behavior:
Tests should run successfully on Python 3.12, with updated assertions.

Error Messages:

  • assertDictContainsSubset: AttributeError: module unittest has no attribute assertDictContainsSubset
  • assertEquals: DeprecationWarning: The assertEquals method is deprecated, use assertEqual instead.

Suggested Fix:

  • Replace assertDictContainsSubset with assertDictEqual.
  • Replace assertEquals with assertEqual.
dee077 added a commit to dee077/openwisp-controller that referenced this issue Dec 23, 2024
Replaced assertEquals with assertEqual and assertDictContainsSubset with for loop to check all key-value pairs.

Fixes openwisp#953
@dee077 dee077 linked a pull request Dec 23, 2024 that will close this issue
3 tasks
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 a pull request may close this issue.

1 participant