summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43843: libregrtest uses threading.excepthook (GH-25400)Victor Stinner2021-04-161-0/+33
| | | | | | | | | test.libregrtest now marks a test as ENV_CHANGED (altered the execution environment) if a thread raises an exception but does not catch it. It sets a hook on threading.excepthook. Use --fail-env-changed option to mark the test as failed. libregrtest regrtest_unraisable_hook() explicitly flushs sys.stdout, sys.stderr and sys.__stderr__.
* bpo-41718: Reduce libregrtest runtest imports (GH-24980)Victor Stinner2021-03-221-0/+102
| | | | | | Move clear_caches() from libregrtest.refleak to libregrtest.utils to avoid importing libregrtest.refleak when it's not needed. clear_caches() now only calls re.purge() if 're' is in sys.modules.
* bpo-38912: regrtest logs unraisable exception into sys.__stderr__ (GH-21718)Victor Stinner2020-08-031-1/+6
| | | | regrtest_unraisable_hook() temporarily replaces sys.stderr with sys.__stderr__ to help to display errors when a test captures stderr.
* bpo-39983: Add test.support.print_warning() (GH-19683)Victor Stinner2020-04-231-1/+1
| | | | | | | Log "Warning -- ..." test warnings into sys.__stderr__ rather than sys.stderr, to ensure to display them even if sys.stderr is captured. test.libregrtest.utils.print_warning() now calls test.support.print_warning().
* bpo-36670: Enhance regrtest (GH-16556)Victor Stinner2019-10-031-4/+7
| | | | | | | | | | | | | | * Add log() method: add timestamp and load average prefixes to main messages. * WindowsLoadTracker: * LOAD_FACTOR_1 is now computed using SAMPLING_INTERVAL * Initialize the load to the arithmetic mean of the first 5 values of the Processor Queue Length value (so over 5 seconds), rather than 0.0. * Handle BrokenPipeError and when typeperf exit. * format_duration(1.5) now returns '1.5 sec', rather than '1 sec 500 ms'
* bpo-37069: regrtest uses sys.unraisablehook (GH-13759)Victor Stinner2019-06-121-0/+17
| | | | | | | | regrtest now uses sys.unraisablehook() to mark a test as "environment altered" (ENV_CHANGED) if it emits an "unraisable exception". Moreover, regrtest logs a warning in this case. Use "python3 -m test --fail-env-changed" to catch unraisable exceptions in tests.
* bpo-36725: regrtest: add TestResult type (GH-12960)Victor Stinner2019-04-261-1/+6
| | | | | | | | | | | | | | | * Add TestResult and MultiprocessResult types to ensure that results always have the same fields. * runtest() now handles KeyboardInterrupt * accumulate_result() and format_test_result() now takes a TestResult * cleanup_test_droppings() is now called by runtest() and mark the test as ENV_CHANGED if the test leaks support.TESTFN file. * runtest() now includes code "around" the test in the test timing * Add print_warning() in test.libregrtest.utils to standardize how libregrtest logs warnings to ease parsing the test output. * support.unload() is now called with abstest rather than test_name * Rename 'test' variable/parameter to 'test_name' * dash_R(): remove unused the_module parameter * Remove unused imports
* bpo-33718: regrtest: use format_duration() to display failed tests (GH-7686)Victor Stinner2018-06-141-9/+18
| | | | | * Enhance also format_duration(): work on integers and rounds towards +infinity (math.ceil). * Write unit tests on format_duration()
* bpo-33718: regrtest: enhance "running:" formatting (GH-7292)Victor Stinner2018-06-011-0/+47
* "running:" progress: Format number of seconds as hours and minutes * format_duration(): count also minutes as hours * Create Lib/test/libregrtest/utils.py