Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Delta Between Two Patch Sets: Lib/test/libregrtest/setup.py

Issue 26295: Random failures when running test suite in parallel (-m test -j0) caused by test_regrtest
Left Patch Set: Created 3 years, 11 months ago
Right Patch Set: Created 3 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/__init__.py ('k') | Lib/test/test_regrtest.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import atexit 1 import atexit
2 import faulthandler 2 import faulthandler
3 import os 3 import os
4 import signal 4 import signal
5 import sys 5 import sys
6 import unittest 6 import unittest
7 from test import support 7 from test import support
8 try: 8 try:
9 import gc 9 import gc
10 except ImportError: 10 except ImportError:
(...skipping 26 matching lines...) Expand all
37 # imports might fail. This affects only the modules imported before os.chdi r(). 37 # imports might fail. This affects only the modules imported before os.chdi r().
38 # These modules are searched first in sys.path[0] (so '' -- the CWD) and if 38 # These modules are searched first in sys.path[0] (so '' -- the CWD) and if
39 # they are found in the CWD their __file__ and __path__ will be relative (th is 39 # they are found in the CWD their __file__ and __path__ will be relative (th is
40 # happens before the chdir). All the modules imported after the chdir, are 40 # happens before the chdir). All the modules imported after the chdir, are
41 # not found in the CWD, and since the other paths in sys.path[1:] are absolu te 41 # not found in the CWD, and since the other paths in sys.path[1:] are absolu te
42 # (site.py absolutize them), the __file__ and __path__ will be absolute too. 42 # (site.py absolutize them), the __file__ and __path__ will be absolute too.
43 # Therefore it is necessary to absolutize manually the __file__ and __path__ of 43 # Therefore it is necessary to absolutize manually the __file__ and __path__ of
44 # the packages to prevent later imports to fail when the CWD is different. 44 # the packages to prevent later imports to fail when the CWD is different.
45 for module in sys.modules.values(): 45 for module in sys.modules.values():
46 if hasattr(module, '__path__'): 46 if hasattr(module, '__path__'):
47 module.__path__ = [os.path.abspath(path) 47 for index, path in enumerate(module.__path__):
48 for path in module.__path__] 48 module.__path__[index] = os.path.abspath(path)
49 if hasattr(module, '__file__'): 49 if hasattr(module, '__file__'):
50 module.__file__ = os.path.abspath(module.__file__) 50 module.__file__ = os.path.abspath(module.__file__)
51 51
52 # MacOSX (a.k.a. Darwin) has a default stack size that is too small 52 # MacOSX (a.k.a. Darwin) has a default stack size that is too small
53 # for deeply recursive regular expressions. We see this as crashes in 53 # for deeply recursive regular expressions. We see this as crashes in
54 # the Python test suite when running test_re.py and test_sre.py. The 54 # the Python test suite when running test_re.py and test_sre.py. The
55 # fix is to set the stack limit to 2048. 55 # fix is to set the stack limit to 2048.
56 # This approach may also be useful for other Unixy platforms that 56 # This approach may also be useful for other Unixy platforms that
57 # suffer from small default stack limits. 57 # suffer from small default stack limits.
58 if sys.platform == 'darwin': 58 if sys.platform == 'darwin':
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 sys.stdout = open(stdout.fileno(), 'w', 110 sys.stdout = open(stdout.fileno(), 'w',
111 encoding=stdout.encoding, 111 encoding=stdout.encoding,
112 errors="backslashreplace", 112 errors="backslashreplace",
113 closefd=False, 113 closefd=False,
114 newline='\n') 114 newline='\n')
115 115
116 def restore_stdout(): 116 def restore_stdout():
117 sys.stdout.close() 117 sys.stdout.close()
118 sys.stdout = stdout 118 sys.stdout = stdout
119 atexit.register(restore_stdout) 119 atexit.register(restore_stdout)
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+