| Commit message (Collapse) | Author | Age |
|
|
|
| |
unittest.doModuleCleanups() (GH-134566)
|
| |
|
| |
|
|
|
|
|
|
|
| |
* Mark functions that will never be called with # pragma: no cover
* Fix testpatch.PatchTest.test_exit_idempotent
.stop() and __exit__ have subtly different code paths, so to really test __exit__ idempotency, we need to call it specifically twice.
|
|
|
|
| |
(#127877)
|
|
|
| |
It failed if it was preceded by test_builtin.
|
|
|
|
| |
assertNotHasAttr() (GH-128818)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the following methods:
* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()
Also improve error messages for assertIsInstance() and
assertNotIsInstance().
|
|
|
|
| |
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
|
| |
|
|
|
| |
Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
|
|
|
| |
This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
|
|
|
|
| |
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
|
|
|
| |
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
|
|
|
|
|
|
|
|
| |
Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.
---------
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
|
|
|
| |
directory (#123820)
|
| |
|
| |
|
| |
|
|
|
|
|
| |
of the deprecated ``asyncio.iscoroutinefunction`` with the ``inspect.iscoroutinefunction`` (#123088)
asyncio.iscoroutinefunction -> inspect.iscoroutinefunction
|
|
|
|
|
| |
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
| |
|
|
|
|
| |
`create_autospec` (#120737)
|
| |
|
|
|
|
|
|
| |
(#120401)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
| |
NonCallableMock.__setattr__ (#120019)
|
|
|
|
|
|
|
|
|
|
| |
set (#119601)
In order to patch flask.g e.g. as in #84982, that
proxies getattr must not be invoked. For that,
mock must not try to read from the original
object. In some cases that is unavoidable, e.g.
when doing autospec. However, patch("flask.g",
new_callable=MagicMock) should be entirely safe.
|
| |
|
|
|
|
|
|
| |
Add tests for "import", pkgutil.resolve_name() and unittest.mock.path()
for cases when "import a.b as x" and "from a import b as x" give
different results.
|
| |
|
|
|
|
| |
avoid leap-year bugs (GH-117107)
|
|
|
|
|
|
|
|
|
|
|
| |
* set default return value of functional types as _mock_return_value
* added test of wrapping child attributes
* added backward compatibility with explicit return
* added docs on the order of precedence
* added test to check default return_value
|
| |
|
|
|
|
|
|
| |
(#106588)" (GH-114470)
This reverts commit 8fc071345b50dd3de61ebeeaa287ccef21d061b2.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#113829)
On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.
Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.
Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
|
|
|
|
|
| |
The intention of exiting 5 was to detect issues where the test suite
wasn't discovered at all. If we skipped tests, it was correctly
discovered.
|
| |
|
|
|
|
|
|
|
| |
IsolatedAsyncioTestCase (#110776)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
|
|
|
|
| |
Align expected and actual titles in output from
assert_has_calls/assert_called_with for greater readability
|
| |
|
|
|
|
|
| |
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
| |
|
| |
|
|
|
|
| |
RuntimeError (#108847)
|
|
|
| |
Use a custom exception to prevent unintentional silence of actual errors.
|
|
|
|
|
|
|
|
| |
threadingmock: Improve test suite to avoid race conditions
Simplify tests and split them into multiple tests to prevent assertions
from triggering race conditions.
Additionally, we rely on calling the mocks without delay to validate the
functionality of matching calls.
|
|
|
|
|
|
|
| |
* lambda has a name of __none__, but no async lambda so this branch is not needed
* _get_signature_object only returns None for bound builtins. There are no async builtins so this branch isn't needed
* Exclude a couple of methods from coverage checking in the downstream rolling backport of mock
|
| |
|
|
|
|
|
|
|
| |
(GH-106366)
Mark `testthreadingmock.py` with `threading_helper.requires_working_threading`.
Also add longer delays to reduce the change of a race conditions on the tests that validate short timeouts.
|
|
|
|
|
|
| |
mock: Rename `wait_until_any_call` to `wait_until_any_call_with`
Rename the method to be more explicit that it expects the args and
kwargs to wait for.
|