diff options
Diffstat (limited to 'django/test/testcases.py')
| -rw-r--r-- | django/test/testcases.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 36366bd777..98ca963834 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -404,6 +404,10 @@ class SimpleTestCase(unittest.TestCase): def enterClassContext(cls, cm): return _enter_context(cm, cls.addClassCleanup) + # Backport of unittest.TestCase.enterContext() from Python 3.11. + def enterContext(self, cm): + return _enter_context(cm, self.addCleanup) + def settings(self, **kwargs): """ A context manager that temporarily sets a setting and reverts to the |
