summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest/testmock
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-90848: Fixed create_autospec ignoring configure_mock style kwargs ↵Miss Islington (bot)2024-05-021-0/+13
| | | | | | | | (GH-118163) (#118517) gh-90848: Fixed create_autospec ignoring configure_mock style kwargs (GH-118163) (cherry picked from commit b28a3339e4c63ea3a801dba9bbbc6af5af42c3a0) Co-authored-by: infohash <46137868+infohash@users.noreply.github.com>
* [3.12] gh-117860: Add tests for resolving names when import rebind names ↵Miss Islington (bot)2024-04-301-0/+67
| | | | | | | | | | (GH-118176) (GH-118432) 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. (cherry picked from commit c0eaa232f63a62e0e0408911ab5f118dca2af607) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-75988: Fix issues with autospec ignoring wrapped object ↵infohash2024-03-221-0/+66
| | | | | | | | | | | | | | | | | (GH-115223) (#117119) gh-75988: Fix issues with autospec ignoring wrapped object (#115223) * 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 (cherry picked from commit 735fc2cbbcf875c359021b5b2af7f4c29f4cf66d)
* [3.12] gh-115274: Fix direct invocation of `testmock/testpatch.py` ↵Miss Islington (bot)2024-02-111-1/+1
| | | | | | | | (GH-115275) (#115280) gh-115274: Fix direct invocation of `testmock/testpatch.py` (GH-115275) (cherry picked from commit f8e9c57067e32baab4ed2fd824b892c52ecb7225) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-111019: Align expected and actual titles in test output ↵Miss Islington (bot)2023-10-181-7/+7
| | | | | | | | | | | (GH-111020) (#111024) gh-111019: Align expected and actual titles in test output (GH-111020) Align expected and actual titles in output from assert_has_calls/assert_called_with for greater readability (cherry picked from commit 77dbd956090aac66e264d9d640f6adb6b0930b87) Co-authored-by: James <morisja@gmail.com>
* [3.12] gh-106300: Improve `assertRaises(Exception)` usages in tests ↵Miss Islington (bot)2023-07-071-2/+3
| | | | | | | | (GH-106302) (GH-106534) gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302) (cherry picked from commit 6e6a4cd52332017b10c8d88fbbbfe015948093f4) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* gh-102978: Fix mock.patch function signatures for class and staticmethod ↵Tomas R2023-04-132-0/+48
| | | | | | | decorators (#103228) Fixes unittest.mock.patch not enforcing function signatures for methods decorated with @classmethod or @staticmethod when patch is called with autospec=True.
* gh-103329: Add regression test for PropertyMock with side effect (#103358)Russell Keith-Magee2023-04-081-1/+22
|
* fix up mock tests coverage (#100874)Chris Withers2023-01-091-8/+4
|
* gh-100690: Raise an AttributeError when the assert_ prefix is forgotten when ↵Christian Klein2023-01-061-0/+24
| | | | | | | | using Mock (#100691) Mock objects which are not unsafe will now raise an AttributeError when accessing an attribute that matches the name of an assertion but without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`. This is in addition to this already happening for accessing attributes with prefixes assert, assret, asert, aseert, and assrt.
* gh-100739: Respect mock spec when checking for unsafe prefixes (#100740)Christian Klein2023-01-041-0/+16
| | | Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* Fix mock code coverage. (#100580)Chris Withers2022-12-281-6/+3
|
* Remove skipped test in test for async mocks. (#100559)Chris Withers2022-12-281-4/+0
| | | | | | Remove skipped test. See discussion on https://github.com/python/cpython/pull/25326. Fix is apparently here, but no-one is confident to review and land: https://github.com/python/cpython/pull/25347.
* gh-100287: Fix unittest.mock.seal with AsyncMock (#100496)Shantanu2022-12-241-1/+13
|
* gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)Carl Meyer2022-12-231-0/+13
|
* gh-98086: Now ``patch.dict`` can decorate async functions (#98095)Nikita Sobolev2022-11-111-0/+17
|
* gh-91803: Mock - fix error when using autospec methods with seal (#92213)andrei kulakov2022-11-071-1/+4
| | | | | | Fixes https://github.com/python/cpython/issues/91803. Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-96624: Fix test_dotted_but_module_not_loaded in testpatch.py (GH-96691)Dennis Sweeney2022-09-091-1/+1
| | | * Update test_dotted_but_module_not_loaded to reflect the move of unittest.test to test.test_unittest.
* gh-93839: Use load_package_tests() for testmock (GH-94055)Christian Heimes2022-06-211-14/+3
| | | | | Fixes failing tests on WebAssembly platforms. Automerge-Triggered-By: GH:tiran
* gh-93839: Move Lib/unttest/test/ to Lib/test/test_unittest/ (#94043)Victor Stinner2022-06-2112-0/+7738
* Move Lib/unittest/test/ to Lib/test/test_unittest/ * Remove Lib/test/test_unittest.py * Replace unittest.test with test.test_unittest * Remove unittest.load_tests() * Rewrite unittest __init__.py and __main__.py * Update build system, CODEOWNERS, and wasm_assets.py