Skip to content
Evergreen Evergreen
Documentation

The deprecated unittest aliases have been removed

Removed. The source gives no day. Replacement: The current TestCase methods: assertEqual(), assertNotEqual(), assertTrue(), assertFalse(), assertAlmostEqual(), assertNotAlmostEqual(), assertRegex(), assertNotRegex(), and assertRaises(); assertDictContainsSubset() has none. Source: What’s New in Python 3.12.

Check a version:

evergreen check pkg:generic/python

Python 3.12 removed the long-deprecated unittest.TestCase aliases, such as assertEquals() and failUnless(), and assertDictContainsSubset(), so using them raises AttributeError.

Look up another package or runtime · <form action="../lookup.html" method="get" role="search"> </form>

   
Status Removed
Severity high
Ecosystem python
Component pkg:generic/python
Affected versions vers:pypi/>=3.12
Date from the source The source gives no day
Replacement The current TestCase methods: assertEqual(), assertNotEqual(), assertTrue(), assertFalse(), assertAlmostEqual(), assertNotAlmostEqual(), assertRegex(), assertNotRegex(), and assertRaises(); assertDictContainsSubset() has none
Evidence last seen 2026-11-02
Reviewed 2026-11-02 by arminazimi
Review due 2027-11-02 (365 days after the last review)
Rule ID python.symbol.unittest.removed-aliases

Sources

Migration

Constraints

  • Keep the behavior of the test unchanged; each alias calls the method its replacement names.
  • assertDictContainsSubset() has no replacement, so its assertion must be rewritten by hand.

Steps

  1. Replace the alias. Replace each reported alias with the current TestCase method that What’s New in Python 3.12 names; rewrite an assertDictContainsSubset() call by hand, because it has no replacement.

Verification

  • python -W error::DeprecationWarning -m pytest: Run the tests with deprecation warnings treated as errors when pytest is used.

Detected by

The python detector. See Detectors and Compatibility.

Other versions of this product

Same ecosystem

Data

This page is generated from registry/python.json, rule python.symbol.unittest.removed-aliases, in the ebb.registry.v2 format (how rules are written). A CLE (ECMA-428) export is not published yet. The same facts are embedded in this page as schema.org structured data.

Last updated