summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest/save_env.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41718: regrtest saved_test_environment avoids imports (GH-24934)Victor Stinner2021-03-221-34/+56
| | | | | | | | | | | | | | | | | | | | | | | | | Reduce the number of modules imported by libregrtest. saved_test_environment no longer imports modules at startup, but try to get them from sys.modules. If an module is missing, skip the test. It also sets directly support.environment_altered. runtest() now now two saved_test_environment instances: one before importing the test module, one after importing it. Remove imports from test.libregrtest.save_env: * asyncio * logging * multiprocessing * shutil * sysconfig * urllib.request * warnings When a test method imports a module (ex: warnings) and the test has a side effect (ex: add a warnings filter), the side effect is not detected, because the module was not imported when Python enters the saved_test_environment context manager.
* bpo-40275: Use new test.support helper submodules in tests (GH-21785)Hai Shi2020-08-081-3/+3
|
* bpo-40275: Use new test.support helper submodules in tests (GH-20849)Hai Shi2020-06-251-1/+2
|
* bpo-37421: urllib.request tests call urlcleanup() (GH-14529)Victor Stinner2019-07-021-0/+13
| | | | | | | | urllib.request tests now call urlcleanup() to remove temporary files created by urlretrieve() tests and to clear the _opener global variable set by urlopen() and functions calling indirectly urlopen(). regrtest now checks if urllib.request._url_tempfiles and urllib.request._opener are changed by tests.
* bpo-36725: regrtest: add TestResult type (GH-12960)Victor Stinner2019-04-261-2/+2
| | | | | | | | | | | | | | | * 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-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-0/+7
| | | | tests (GH-7328)
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-8/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* threading_cleanup() failure marks test as ENV_CHANGED (#2500)Victor Stinner2017-06-301-1/+7
| | | | | | | If threading_cleanup() fails to cleanup threads, set a a new support.environment_altered flag to true, flag uses by save_env which is used by regrtest to check if a test altered the environment. At the end, the test file fails with ENV_CHANGED instead of SUCCESS, to report that it altered the environment.
* regrtest: always show before/after of modified env (#1192)Victor Stinner2017-04-191-3/+2
| | | | | | | | Buildbots don't run tests with -vv and so only log "xxx was modified by test_xxx" which is not enough to debug such random issue. In many cases, I'm unable to reproduce the warning and so unable to fix it. Always logging the value before and value after should help to debug such warning on buildbots.
* Issue 27948: Allow backslashes in the literal string portion of f-strings, ↵Eric V. Smith2016-09-101-1/+1
| | | | but not in the expressions. Also, require expressions to begin and end with literal curly braces.
* Closes issue 27921: Disallow backslashes anywhere in f-strings. This is a ↵Eric V. Smith2016-09-031-1/+1
| | | | temporary restriction. In 3.6 beta 2, the plan is to again allow backslashes in the string parts of f-strings, but disallow them in the expression parts.
* Issue #27829: libregrtest.save_env: flush stderrVictor Stinner2016-08-221-6/+4
| | | | | | Use flush=True to try to get a warning which is missing in buildbots. Use also f-string to make the code shorter.
* Issue #27787: Merge regrtest fixup from 3.5Martin Panter2016-08-201-0/+1
|
* Merge 3.5 (regrtest)Victor Stinner2016-03-291-0/+1
|
* Backed out changeset 245a16f33c4bVictor Stinner2016-03-251-279/+202
| | | | Serhiy asked me to review it.
* Rework libregrtest.save_envVictor Stinner2016-03-251-202/+279
| | | | | | | | | | | * Replace get/restore methods with a Resource class and Resource subclasses * Create ModuleAttr, ModuleAttrList and ModuleAttrDict helper classes * Use __subclasses__() to get resource classes instead of using an hardcoded list (2 shutil resources were missinged in the list!) * Don't define MultiprocessingProcessDangling resource if the multiprocessing module is missing * Nicer diff for dictionaries. Useful for the big os.environ dict * Reorder code to group resources
* Merge from 3.5 for issue #25188.Brett Cannon2015-10-021-2/+3
|
* Issue #25220: Move most regrtest.py code to libregrtestVictor Stinner2015-09-261-0/+284