usrbinenv python3 script to run python regression tests run this script with h or help for documentation alias for backward compatibility just in case 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 toplevel modules even when people or buildbots invoke regrtest py directly instead of using the m switch 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 sanity check usr bin env python3 script to run python regression tests run this script with h or help for documentation alias for backward compatibility just in case 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 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 sanity check
import os
import sys
from test.libregrtest.main import main



main_in_temp_cwd = main


def _main():
    global __file__

    
    
    
    
    
    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

    
    
    
    
    __file__ = os.path.abspath(__file__)

    
    assert __file__ == os.path.abspath(sys.argv[0])

    main()


if __name__ == '__main__':
    _main()