Commit Graph

12 Commits

Author SHA1 Message Date
Hugo van Kemenade 05d12eecbd
gh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` env vars (#127877) 2025-01-21 16:10:08 +00:00
Serhiy Storchaka 06cad77a5b
gh-71339: Add additional assertion methods for unittest (GH-128707)
Add the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

Also improve error messages for assertIsInstance() and
assertNotIsInstance().
2025-01-14 10:02:38 +02:00
Hugo van Kemenade afb9dc887c
gh-128595: Add test class helper to force no terminal colour (#128687)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-13 11:05:02 +00:00
Hugo van Kemenade 23f2e8f13c
gh-127221: Add colour to unittest output (#127223)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-12-05 21:10:46 +02:00
Irit Katriel e97910cdb7
gh-125522 : add explicit exception types to bare excepts in tests (#125523) 2024-10-15 17:00:04 +01:00
Victor Stinner ae319e4b43
gh-105407: Remove unused imports in tests (#105408) 2023-06-06 22:50:43 +02:00
Stefano Rivera 76632b836c
gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)
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
2023-04-27 01:28:46 +00:00
Giampaolo Rodola 6883007a86
bpo-4080: unittest durations (#12271) 2023-04-03 00:12:51 +02:00
AlexTate 72ec518203
gh-98458: unittest: bugfix for infinite loop while handling chained 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
2022-12-04 11:37:55 -08:00
Robert O'Shea cd26595232
gh-95454: Replace truthy/falsy with true/false (GH-95456) 2022-07-30 00:42:21 -07:00
Victor Stinner 47e35625ff
gh-84623: Remove unused imports (#94132) 2022-06-22 19:14:27 +02:00
Victor Stinner c735d54534
gh-93839: Move Lib/unttest/test/ to Lib/test/test_unittest/ (#94043)
* 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
2022-06-21 10:27:59 +02:00