| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Patcher's __exit__() is now never called if its __enter__() is failed.
Returning true from __exit__() silences now the exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* use the `: pass` and `: yield` patterns for code that isn't expected to ever be executed.
* The _Call items passed to _AnyComparer are only ever of length two, so assert instead of if/else
* fix typo
* Fix bug, where stop-without-start patching dict blows up with `TypeError: 'NoneType' object is not iterable`, highlighted by lack of coverage of an except branch.
* The fix for bpo-37972 means _Call.count and _Call.index are no longer needed.
* add coverage for calling next() on a mock_open with readline.return_value set.
* __aiter__ is defined on the Mock so the one on _AsyncIterator is never called.
|
|
|
|
|
| |
As the function was not registering in the active patches, the mocks
started by `mock.patch.dict` were not being stopped when
`mock.patch.stopall` was being called.
|
|
|
|
|
| |
* add test for path.dict using OrderedDict
Co-authored-by: Yu Tomita nekobon@users.noreply.github.com
|
|
|
| |
This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument.
|
| |
|
|
|
|
|
|
| |
(GH-11062)
|
|
|
|
|
|
|
|
|
|
|
| |
This was achieved by:
* moving many pass statements in tests onto their own lines, so they pass line coverage and can match an easy ignore pattern if branch coverage is added later.
* removing code that cannot be reached.
* removing long-disabled tests.
* removing unused code.
* adding tests for uncovered code
It turned out that removing `if __name__ == '__main__'` blocks that run unittest.main() at the bottom of test files was surprisingly contentious, so they remain and can be filtered out with an appropriate .coveragerc.
|
| |
|
|
|
|
|
| |
(GH-11613)
Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>
|
|
|
|
|
|
| |
Return None after calling unittest.mock.patch.object.stop() regardless of whether the object was started. This makes the method idempotent.
https://bugs.python.org/issue36366
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
call GH#12000
* Resolve string target to patch.dict during function call
* Add NEWS entry
* Remove unneeded call
* Restore original value for support.target and refactor assertions
* Add extra assertion to verify unpatched dict
|
|
|
|
| |
(GH-8520)
|
|
|
|
| |
assert_called, assert_not_called, and assert_called_once.
|
| |
|
|
|
|
|
|
| |
original values after patching.
Patch contributed by Sean McCully.
|
|\ |
|
| |
| |
| |
| | |
deterministically when the same name was patched multiple times.
|
|/
|
|
| |
patching builtin names.
|
| |
|
| |
|
|
|
|
| |
be callable if __call__ is in the spec
|
|
|
|
| |
patcher spec arguments
|
| |
|
| |
|
|
|