GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-45162: Remove many old deprecated unittest features by serhiy-storchaka · Pull Request #28268 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Sep 10, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • "fail*" and "assert*" aliases of TestCase methods.
  • Broken from start TestCase method assertDictContainsSubset().
  • Ignored TestLoader.loadTestsFromModule() parameter use_load_tests.
  • Old alias _TextTestResult of TextTestResult.

https://bugs.python.org/issue45162

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
bpo-45162: Remove many old deprecated unittest features
4062f07
* "fail*" and "assert*" aliases of TestCase methods.
* Broken from start TestCase method assertDictContainsSubset().
* Ignored TestLoader.loadTestsFromModule() parameter use_load_tests.
* Old alias _TextTestResult of TextTestResult.
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Sep 10, 2021
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Sep 10, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Sep 10, 2021
@serhiy-storchaka
Fix removed reference.
2d96fb9
@ambv ambv added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 10, 2021
@bedevere-bot

bedevere-bot commented Sep 10, 2021

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ambv for commit 2d96fb9 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 10, 2021
@serhiy-storchaka
Merge branch 'main' into unittest-remove-deprecated
e97e04d
@ambv
ambv self-requested a review September 12, 2021 16:18
@erlend-aasland

erlend-aasland commented Sep 12, 2021

Copy link
Copy Markdown
Contributor

See also GH-20400. Should I reopen?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Sep 12, 2021

Copy link
Copy Markdown
Member Author

I do not know why GH-20400 was closed. Seems there were no objections against it.

But many of these functions are still used in Python tests, so we should first clean up tests from them. Also, we need to research how often they are used in third-party code. The deprecation period can be prolonged if there are many occurrences. All features removed in this PR were deprecated for at least 6 releases.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Sep 12, 2021

Copy link
Copy Markdown
Contributor

I do not know why GH-20400 was closed. Seems there were no objections against it.

I closed it because I got no response, and I had enough to do already with my sqlite3 PR's :)

Also, we need to research how often they are used in third-party code. The deprecation period can be prolonged if there are many occurrences. All features removed in this PR were deprecated for at least 6 releases.

Absolutely.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka added 2 commits September 16, 2021 22:51
@serhiy-storchaka
Merge branch 'main' into unittest-remove-deprecated
34be99f
@serhiy-storchaka
Merge branch 'main' into unittest-remove-deprecated
c5f5c6f
@serhiy-storchaka
serhiy-storchaka merged commit b0a6ede into python:main Sep 17, 2021
@bedevere-bot bedevere-bot removed the awaiting core review label Sep 17, 2021
@serhiy-storchaka
serhiy-storchaka deleted the unittest-remove-deprecated branch September 17, 2021 10:33
This was referenced Oct 4, 2021
Use assertEqual instead of assertEquals for Python 3.11 compatibility. spyoungtech/grequests#152
Merged
Use assertRegex for Python 3.11 compatibility. PostHog/posthog#6225
Merged
Deprecated aliases in unittest were removed in Python 3.11 simplistix/testfixtures#162
Closed
Use assertRaisesRegex instead of assertRaisesRegexp for Python 3.11 compatibility. NaturalHistoryMuseum/pyzbar#106
Merged
Deprecated unittest aliases were removed in Python 3.11 pytest-dev/nose2pytest#19
Closed
Use assertEqual instead of assertEquals for Python 3.11 compatibility. giampaolo/psutil#1995
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. stravalib/stravalib#223
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. Legrandin/pycryptodome#560
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. cpburnz/python-pathspec#51
Merged
This was referenced Oct 11, 2021
Refactor deprecated unittest aliases for Python 3.11 compatibility. pyradius/pyrad#162
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. luozhouyang/python-string-similarity#30
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. django-cms/djangocms-attributes-field#41
Merged
gpshead added a commit that referenced this pull request Jan 27, 2022
@gpshead
bpo-45162: Revert "Remove many old deprecated unittest features" (GH-…
b50322d
…30935)

Revert "bpo-45162: Remove many old deprecated unittest features (GH-28268)"

This reverts commit b0a6ede.

We're deferring this change until 3.12 while upstream projects that use
the legacy assertion method names are fixed.  See the issue for links
to the discussion. Many upstream projects now have issues and PRs
filed.
@tirkarthi tirkarthi mentioned this pull request Mar 8, 2022
Refactor deprecated unittest aliases for Python 3 compatibility. pypyodbc/pypyodbc#16
Merged
This was referenced Mar 21, 2022
test: Use assertEqual instead of assertEquals for Python 3.11 compatibility. frappe/frappe#16357
Merged
Refactor deprecated unittest aliases for Python 3.11 compatibility. grycap/im#1337
Merged
Use assertEqual instead of assertEquals for Python 3.11 compatibility. Mathics3/mathics-core#235
Merged
Use assertEqual instead of assertEquals for Python 3.11 compatibility. cloudtools/stacker#775
Open
@serhiy-storchaka serhiy-storchaka mentioned this pull request Apr 10, 2022
Remove old deprecated unittest features #89325
Closed
arkamar added a commit to arkamar/testresources that referenced this pull request May 31, 2023
@arkamar
Refactor failIf to assertFalse for Python 3.12 Compatibility
7bb62a1
This commit replaces deprecated failIf calls with assertFalse in the
test_resourced_test_case.py file. The failIf method was removed in
Python 3.12 [1-3].

[1] https://docs.python.org/3.12/whatsnew/3.12.html#removed
[2] python/cpython#89325
[3] python/cpython#28268

Signed-off-by: Petr Vaněk <[email protected]>
@arkamar arkamar mentioned this pull request May 31, 2023
Refactor failIf to assertFalse for Python 3.12 Compatibility testing-cabal/testresources#15
Merged
@konnectr konnectr mentioned this pull request Aug 1, 2023
Fix warning test query getredash/redash#6335
Merged
1 of 10 tasks
parthea added a commit to googleapis/python-storage that referenced this pull request Nov 29, 2023
@parthea
remove usage of deprecated assertDictContainsSubset python/cpython#28268
a7ce56c
cojenco added a commit to googleapis/python-storage that referenced this pull request Dec 1, 2023
@gcf-owl-bot @parthea @cojenco
feat: Add support for Python 3.12 (#1187)
ecf4150
* chore(python): Add Python 3.12

Source-Link: googleapis/synthtool@af16e6d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5

* Add trove classifier for python 3.12

* Update contributing.rst, noxfile and constraints to include python 3.12

* remove usage of deprecated assertDictContainsSubset python/cpython#28268

* update tests KMS key settings

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: Cathy Ouyang <[email protected]>
Silvanoc added a commit to linkml/linkml-runtime that referenced this pull request Jan 30, 2024
@Silvanoc
fix: replace deprecated method
ebef8a9
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
Silvanoc added a commit to linkml/linkml-runtime that referenced this pull request Jan 30, 2024
@Silvanoc
fix: replace deprecated method
79043b6
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
Silvanoc added a commit to linkml/linkml-runtime that referenced this pull request Jan 30, 2024
@Silvanoc
fix: replace deprecated method
e8cdcec
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
Silvanoc added a commit to linkml/linkml-runtime that referenced this pull request Jan 30, 2024
@Silvanoc
fix: replace deprecated method
516f1cc
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
facebook-github-bot pushed a commit to meta/openbmc that referenced this pull request Feb 1, 2024
@cjcon90 @facebook-github-bot
Update references to TestCase.assertEquals
c410db3
Summary:
assertEquals used to be an alias to assertEqual, but seems the aliases were removed:

python/cpython#28268

This is causing some tests to fail with
```
======================================================================
ERROR: test_set_all_fans_and_read (tests.grandcanyon.test_fans.FansTest.test_set_all_fans_and_read)
Test setting all fans speed and read to ensure it is the same
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/run/tests2/common/base_fans_test.py", line 362, in test_set_all_fans_and_read
    speed = self.get_speed(data)
            ^^^^^^^^^^^^^^^^^^^^
  File "/run/tests2/common/base_fans_test.py", line 287, in get_speed
    self.assertEquals(num, self.names[m.group(1)], "Bad fan index")
    ^^^^^^^^^^^^^^^^^
AttributeError: 'FansTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?
```

Test Plan:
Test run on grandcanyon
```
$ netcastle --team openbmc --platform grandcanyon

Ran 90 tests in 39 mins 54.908 secs
[   ERROR] 0
[  FAILED] 0
[ TIMEOUT] 0
[  PASSED] 70
[ SKIPPED] 20
[ OMITTED] 0
[ RETRIED] 0
2024/02/01 02:36:52.896|522087|MainThread|I|abstract_runner: All tests passed!

Reviewed By: lsiudut

Differential Revision: D53307151

fbshipit-source-id: 163ef91fd883ca607f6bfdb0b10e756015957e74
Silvanoc added a commit to linkml/linkml-runtime that referenced this pull request Feb 13, 2024
@Silvanoc
fix: replace deprecated method
ad09d00
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
@Silvanoc Silvanoc mentioned this pull request Feb 13, 2024
fix: replace deprecated method linkml/linkml-runtime#297
Merged
@jiasli

jiasli commented Jul 15, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@tirkarthi, what is the best drop-in replacement for assertDictContainsSubset? https://stackoverflow.com/a/19221301/2199657 mentioned:

Drop in replacement is to use assertLessEqual and .items() on the dicts.

That is:

- self.assertDictContainsSubset(a, b)
+ self.assertLessEqual(a.items(), b.items())

twilio/twilio-python#636 and tensorflow/tfx@010e94d adopted different approaches. What is Python's official recommendation?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jiasli jiasli mentioned this pull request Jul 15, 2024
{Misc.} Remove all occurrences of assertDictContainsSubset Azure/azure-cli#29121
Merged
3 tasks done
@irtazaakram irtazaakram mentioned this pull request Jul 25, 2024
DeprecationWarning: assertDictContainsSubset is deprecated openedx/openedx-platform#35175
Closed
@akx akx mentioned this pull request Aug 29, 2024
Modernize tests maxmind/GeoIP2-python#180
Closed
@leoaulasneo98 leoaulasneo98 mentioned this pull request Feb 10, 2025
Edx platform 35175 deprecate assert dict contains subset openedx/openedx-platform#36236
Merged
iQuxLE pushed a commit to linkml/linkml that referenced this pull request Aug 18, 2025
@Silvanoc
fix: replace deprecated method
8619fb3
Unittest method "assertEquals" is deprecated since Python 3.1, but was
still present in the code.

The deprecated method was removed with bpo-45162 [1] and merged on 3.11.

[1]: python/cpython#28268

Signed-off-by: Silvano Cirujano Cuesta <[email protected]>
@MasashiFukuzawa MasashiFukuzawa mentioned this pull request Oct 10, 2025
Set up tests to run on GitHub Actions aces-inc/ndkale#10
Merged
parthea added a commit to googleapis/google-cloud-python that referenced this pull request Mar 9, 2026
@gcf-owl-bot @parthea @cojenco
feat: Add support for Python 3.12 (#1187)
d09b381
* chore(python): Add Python 3.12

Source-Link: googleapis/synthtool@af16e6d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5

* Add trove classifier for python 3.12

* Update contributing.rst, noxfile and constraints to include python 3.12

* remove usage of deprecated assertDictContainsSubset python/cpython#28268

* update tests KMS key settings

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: Cathy Ouyang <[email protected]>
chalmerlowe pushed a commit to GoogleCloudPlatform/python-docs-samples that referenced this pull request Apr 7, 2026
@gcf-owl-bot @parthea @cojenco
feat: Add support for Python 3.12 (#1187)
4bf3e90
* chore(python): Add Python 3.12

Source-Link: googleapis/synthtool@af16e6d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5

* Add trove classifier for python 3.12

* Update contributing.rst, noxfile and constraints to include python 3.12

* remove usage of deprecated assertDictContainsSubset python/cpython#28268

* update tests KMS key settings

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: Cathy Ouyang <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request May 2, 2026
http2: test scaffolding and zero-length payload flush fix hivesolutions/netius#63
Merged
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ambv ambv Awaiting requested review from ambv

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@serhiy-storchaka @bedevere-bot @erlend-aasland @jiasli @ambv @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.