| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
unittest.TestCase.assertWarns no longer raises a RuntimeException
when accessing a module's ``__warningregistry__`` causes importation of a new
module, or when a new module is imported in another thread.
(cherry picked from commit 46398fba4d66ad342cf2504ef947b5fb857423b2)
Co-authored-by: kernc <kerncece@gmail.com>
|
|
|
|
|
|
|
| |
TestCase.shortDescription (GH-18175) (#18323)
(cherry picked from commit 032de7324e30c6b44ef272cea3be205a3d768759)
Co-authored-by: Steve Cirelli <scirelli+git@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-9082) (#15781)
* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled
* Change default reason to empty string
* Fix rst formatting of NEWS entry
(cherry picked from commit d5fd75c53fad7049fc640c9a6162d35f0c5bea03)
Co-authored-by: Naitree Zhu <Naitreey@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add explicit `asyncSetUp` and `asyncTearDown` methods.
The rest is the same as for #13228
`AsyncTestCase` create a loop instance for every test for the sake of test isolation.
Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8.
The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead.
The PR adds four overridable methods to base `unittest.TestCase` class:
```
def _callSetUp(self):
self.setUp()
def _callTestMethod(self, method):
method()
def _callTearDown(self):
self.tearDown()
def _callCleanup(self, function, /, *args, **kwargs):
function(*args, **kwargs)
```
It allows using asyncio facilities with minimal influence on the unittest code.
The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`.
https://bugs.python.org/issue32972
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Deprecated passing the following arguments as keyword arguments:
- "func" in functools.partialmethod(), weakref.finalize(),
profile.Profile.runcall(), cProfile.Profile.runcall(),
bdb.Bdb.runcall(), trace.Trace.runfunc() and
curses.wrapper().
- "function" in unittest.addModuleCleanup() and
unittest.TestCase.addCleanup().
- "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor
and concurrent.futures.ProcessPoolExecutor.
- "callback" in contextlib.ExitStack.callback(),
contextlib.AsyncExitStack.callback() and
contextlib.AsyncExitStack.push_async_callback().
- "c" and "typeid" in the create() method of multiprocessing.managers.Server
and multiprocessing.managers.SharedMemoryServer.
- "obj" in weakref.finalize().
Also allowed to pass arbitrary keyword arguments (even "self" and "func")
if the above arguments are passed as positional argument.
|
| |
|
| |
|
|
|
|
| |
(GH-8623)
|
|
|
|
| |
The word "difference" from missing the sentence.
This clarifies that it compares the difference between the two objects.
|
| |
|
|
|
|
| |
order of keyword arguments of TestCase.subTest().
|
|
|
|
|
|
|
|
|
|
|
|
| |
* #30190 / unittest / assertAlmostEqual(delta=...) / error msg: show the difference between the 2 numbers in case of failure
* safe_repr() diff
* also show difference when passing 'places' argument
* refactoring
* update Misc/NEWS
|
|
|
|
| |
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
|
| |
|
|
|
|
| |
Based on patch by Ville Skyttä.
|
|
|
|
|
| |
differing items (like bytes in the -b mode). This affects assertListEqual()
and assertTupleEqual().
|
|\
| |
| |
| | |
Patch from Berker Peksag.
|
| |
| |
| |
| | |
Patch from Berker Peksag.
|
| | |
|
| |
| |
| |
| | |
Patch from Ilia Kurenkov.
|
| |
| |
| |
| |
| | |
assertWarnsRegex() assertments now check the type of the first argument
to prevent possible user error. Based on patch by Daniel Wagner-Hall.
|
|/
|
|
|
| |
assertWarnsRegex() checks now emits a deprecation warning when callable is
None or keyword arguments except msg is passed in the context manager mode.
|
| |
|
|
|
|
|
|
| |
assertWarnsRegex() checks are not longer successful if the callable is None.
Added tests for assertRaises().
|
|
|
|
| |
returned NotImplemented. Removed incorrect implementations of __ne__().
|
|
|
|
| |
in the exception's traceback.
|
|
|
|
|
|
|
| |
Previously a non-string, non-regex second argument and missing callable
argument could cause the test to appear to always pass.
Initial patch by Kamilla Holanda.
|
|
|
|
| |
reference cycles between frames and the _Outcome instance.
|
|
|
|
| |
strings in error report.
|
|
|
|
| |
ensure that a block of code emits a message using the logging module.
|
|\ |
|
| |
| |
| |
| | |
docstring. Patch by Boris Feld.
|
|\ \
| |/ |
|
| |\ |
|
| | | |
|
|/ /
| |
| |
| | |
procedurally generate, in an easy way, small test instances.
|
|\ \
| |/
| |
| | |
Patch by Serhiy Storchaka.
|
| |
| |
| |
| | |
Patch by Serhiy Storchaka.
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| | |
Patch from Serhiy Storchaka.
|
|\ \
| |/
| |
| | |
class that doesn't inherit from TestCase (i.e. a mixin).
|
| |
| |
| |
| | |
class that doesn't inherit from TestCase (i.e. a mixin).
|
| | |
|
| | |
|
|\ \
| |/ |
|
| | |
|