@@ -1495,6 +1495,16 @@ Test cases
14951495 .. versionadded :: 3.1
14961496
14971497
1498+ .. method :: enterContext(cm)
1499+
1500+ Enter the supplied :term: `context manager `. If successful, also
1501+ add its :meth: `~object.__exit__ ` method as a cleanup function by
1502+ :meth: `addCleanup ` and return the result of the
1503+ :meth: `~object.__enter__ ` method.
1504+
1505+ .. versionadded :: 3.11
1506+
1507+
14981508 .. method :: doCleanups()
14991509
15001510 This method is called unconditionally after :meth: `tearDown `, or
@@ -1510,6 +1520,7 @@ Test cases
15101520
15111521 .. versionadded :: 3.1
15121522
1523+
15131524 .. classmethod :: addClassCleanup(function, /, *args, **kwargs)
15141525
15151526 Add a function to be called after :meth: `tearDownClass ` to cleanup
@@ -1524,6 +1535,16 @@ Test cases
15241535 .. versionadded :: 3.8
15251536
15261537
1538+ .. classmethod :: enterClassContext(cm)
1539+
1540+ Enter the supplied :term: `context manager `. If successful, also
1541+ add its :meth: `~object.__exit__ ` method as a cleanup function by
1542+ :meth: `addClassCleanup ` and return the result of the
1543+ :meth: `~object.__enter__ ` method.
1544+
1545+ .. versionadded :: 3.11
1546+
1547+
15271548 .. classmethod :: doClassCleanups()
15281549
15291550 This method is called unconditionally after :meth: `tearDownClass `, or
@@ -1571,6 +1592,16 @@ Test cases
15711592
15721593 This method accepts a coroutine that can be used as a cleanup function.
15731594
1595+ .. coroutinemethod :: enterAsyncContext(cm)
1596+
1597+ Enter the supplied :term: `asynchronous context manager `. If successful,
1598+ also add its :meth: `~object.__aexit__ ` method as a cleanup function by
1599+ :meth: `addAsyncCleanup ` and return the result of the
1600+ :meth: `~object.__aenter__ ` method.
1601+
1602+ .. versionadded :: 3.11
1603+
1604+
15741605 .. method :: run(result=None)
15751606
15761607 Sets up a new event loop to run the test, collecting the result into
@@ -2465,6 +2496,16 @@ To add cleanup code that must be run even in the case of an exception, use
24652496 .. versionadded :: 3.8
24662497
24672498
2499+ .. classmethod :: enterModuleContext(cm)
2500+
2501+ Enter the supplied :term: `context manager `. If successful, also
2502+ add its :meth: `~object.__exit__ ` method as a cleanup function by
2503+ :func: `addModuleCleanup ` and return the result of the
2504+ :meth: `~object.__enter__ ` method.
2505+
2506+ .. versionadded :: 3.11
2507+
2508+
24682509.. function :: doModuleCleanups()
24692510
24702511 This function is called unconditionally after :func: `tearDownModule `, or
@@ -2480,6 +2521,7 @@ To add cleanup code that must be run even in the case of an exception, use
24802521
24812522 .. versionadded :: 3.8
24822523
2524+
24832525Signal Handling
24842526---------------
24852527
0 commit comments