File tree 1 file changed +16
-5
lines changed 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11
11
12
12
import os
13
13
import sys
14
- from test .libregrtest import main , main_in_temp_cwd
14
+ from test .libregrtest import main_in_temp_cwd
15
15
16
16
17
- if __name__ == '__main__' :
17
+ # alias needed by other scripts
18
+ main = main_in_temp_cwd
19
+
20
+
21
+ def _main ():
22
+ global __file__
23
+
18
24
# Remove regrtest.py's own directory from the module search path. Despite
19
25
# the elimination of implicit relative imports, this is still needed to
20
26
# ensure that submodules of the test package do not inappropriately appear
21
27
# as top-level modules even when people (or buildbots!) invoke regrtest.py
22
28
# directly instead of using the -m switch
23
29
mydir = os .path .abspath (os .path .normpath (os .path .dirname (sys .argv [0 ])))
24
- i = len (sys .path )
30
+ i = len (sys .path ) - 1
25
31
while i >= 0 :
26
- i -= 1
27
32
if os .path .abspath (os .path .normpath (sys .path [i ])) == mydir :
28
33
del sys .path [i ]
34
+ else :
35
+ i -= 1
29
36
30
37
# findtestdir() gets the dirname out of __file__, so we have to make it
31
38
# absolute before changing the working directory.
36
43
# sanity check
37
44
assert __file__ == os .path .abspath (sys .argv [0 ])
38
45
39
- main_in_temp_cwd ()
46
+ main ()
47
+
48
+
49
+ if __name__ == '__main__' :
50
+ _main ()
You can’t perform that action at this time.
0 commit comments