mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00

Reloading the warnings module duplicates filters in warnings.filters. Fixing the issue is tricky. It was decided to simply remove the check from Python 3.5, since the bug only impacts Python unit tests, not real applications. The check is kept in Python 3.6 and newer.
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
#! /usr/bin/env python3
|
|
|
|
"""
|
|
Script to run Python regression tests.
|
|
|
|
Run this script with -h or --help for documentation.
|
|
"""
|
|
|
|
# We import importlib *ASAP* in order to test #15386
|
|
import importlib
|
|
|
|
import os
|
|
import sys
|
|
from test.libregrtest import main
|
|
|
|
|
|
# Alias for backward compatibility (just in case)
|
|
main_in_temp_cwd = main
|
|
|
|
|
|
def _main():
|
|
global __file__
|
|
|
|
# Remove regrtest.py's own directory from the module search path. Despite
|
|
# the elimination of implicit relative imports, this is still needed to
|
|
# ensure that submodules of the test package do not inappropriately appear
|
|
# as top-level modules even when people (or buildbots!) invoke regrtest.py
|
|
# directly instead of using the -m switch
|
|
mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
|
|
i = len(sys.path) - 1
|
|
while i >= 0:
|
|
if os.path.abspath(os.path.normpath(sys.path[i])) == mydir:
|
|
del sys.path[i]
|
|
else:
|
|
i -= 1
|
|
|
|
# findtestdir() gets the dirname out of __file__, so we have to make it
|
|
# absolute before changing the working directory.
|
|
# For example __file__ may be relative when running trace or profile.
|
|
# See issue #9323.
|
|
__file__ = os.path.abspath(__file__)
|
|
|
|
# sanity check
|
|
assert __file__ == os.path.abspath(sys.argv[0])
|
|
|
|
main()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
_main()
|