summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-108927: Fix test_import + test_importlib + test_unittest problem ↵Miss Islington (bot)2023-09-051-2/+3
| | | | | | | | (GH-108929) (#108954) gh-108927: Fix test_import + test_importlib + test_unittest problem (GH-108929) (cherry picked from commit 3f89b257639dd817a32079da2ae2c4436b8e82eb) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-106300: Improve errors testing in test_unittest.test_runner ↵Miss Islington (bot)2023-08-161-52/+65
| | | | | | | | | | (GH-106737) (#108006) gh-106300: Improve errors testing in test_unittest.test_runner (GH-106737) Use a custom exception to prevent unintentional silence of actual errors. (cherry picked from commit fd9d70a94de5b0756b52b9ae21e236e25545db4f) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [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-68968: Correcting message display issue with assertEqual (#103937)Michael Blahay2023-05-042-3/+63
|
* gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)Stefano Rivera2023-04-273-20/+48
| | | | | | | | As discussed in https://discuss.python.org/t/unittest-fail-if-zero-tests-were-discovered/21498/7 It is common for test runner misconfiguration to fail to find any tests, This should be an error. Fixes: #62432
* gh-48330: address review comments to PR-12271 (#103209)Giampaolo Rodola2023-04-161-6/+6
| | | | | address review comments to PR-12271 Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* 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
|
* gh-48330: assert warning is emitted on unittest.TestResult with no ↵Irit Katriel2023-04-061-1/+2
| | | | addDuration (#103309)
* bpo-4080: unittest durations (#12271)Giampaolo Rodola2023-04-025-22/+95
|
* gh-102515: Remove unused imports in the `Lib/` directory (#102516)Alex Waygood2023-03-081-1/+0
|
* 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-98458: unittest: bugfix for infinite loop while handling chained ↵AlexTate2022-12-041-0/+56
| | | | | | | exceptions that contain cycles (#98459) * Bugfix addressing infinite loop while handling self-referencing chained exception in TestResult._clean_tracebacks() * Bugfix extended to properly handle exception cycles in _clean_tracebacks. The "seen" set follows the approach used in the TracebackException class (thank you @iritkatriel for pointing it out) * adds a test for a single chained exception that holds a self-loop in its __cause__ and __context__ attributes
* gh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646)Serhiy Storchaka2022-11-221-0/+27
| | | | | Now addClassCleanup() uses separate lists for different TestCase subclasses, and doClassCleanups() only cleans up the particular class.
* Add more details in test_unittest (GH-99626)Serhiy Storchaka2022-11-212-35/+67
|
* 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-97837: Change deprecation warning message in `unittest` (#97838)Nikita Sobolev2022-10-052-6/+28
|
* 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-96021: Explicitly close the IsolatedAsyncioTestCase runner in tests ↵Serhiy Storchaka2022-08-241-2/+7
| | | | | | | | | (GH-96135) Tests for IsolatedAsyncioTestCase.debug() rely on the runner be closed in __del__. It makes tests depending on the GC an unreliable on other implementations. It is better to close the runner explicitly even if currently there is no a public API for this.
* GH-95736: fix IsolatedAsyncioTestCase to initialize Runner before calling ↵Kumar Aditya2022-08-161-0/+15
| | | | setup functions (#95898)
* gh-95454: Replace truthy/falsy with true/false (GH-95456)Robert O'Shea2022-07-301-2/+2
|
* Revert "bpo-45162: Revert "Remove many old deprecated unittest features"" ↵Serhiy Storchaka2022-06-266-238/+24
| | | | | | (GH-92556) This reverts commit b50322d20337ca468f2070eedb051a16ee1eba94.
* gh-84623: Remove unused imports (#94132)Victor Stinner2022-06-222-3/+1
|
* 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-2130-0/+18359
* 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