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

Delta Between Two Patch Sets: Lib/test/regrtest.py

Issue 3754: cross-compilation support for python build
Left Patch Set: Created 1 year, 2 months ago
Right Patch Set: Created 11 months, 2 weeks 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:
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/sysconfig.py ('k') | Lib/test/test_capi.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
(no file at all)
1 #! /usr/bin/env python3 1 #! /usr/bin/env python3
2 2
3 """ 3 """
4 Usage: 4 Usage:
5 5
6 python -m test [options] [test_name1 [test_name2 ...]] 6 python -m test [options] [test_name1 [test_name2 ...]]
7 python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] 7 python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
8 8
9 9
10 If no arguments or options are provided, finds all files matching 10 If no arguments or options are provided, finds all files matching
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 """ 1774 """
1775 1775
1776 assert self.isvalid() 1776 assert self.isvalid()
1777 return self.expected 1777 return self.expected
1778 1778
1779 def _make_temp_dir_for_build(TEMPDIR): 1779 def _make_temp_dir_for_build(TEMPDIR):
1780 # When tests are run from the Python build directory, it is best practice 1780 # When tests are run from the Python build directory, it is best practice
1781 # to keep the test files in a subfolder. It eases the cleanup of leftover 1781 # to keep the test files in a subfolder. It eases the cleanup of leftover
1782 # files using command "make distclean". 1782 # files using command "make distclean".
1783 if sysconfig.is_python_build(): 1783 if sysconfig.is_python_build():
1784 TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build') 1784 TEMPDIR = os.path.abspath('build')
1785 TEMPDIR = os.path.abspath(TEMPDIR)
1786 try: 1785 try:
1787 os.mkdir(TEMPDIR) 1786 os.mkdir(TEMPDIR)
1788 except FileExistsError: 1787 except FileExistsError:
1789 pass 1788 pass
1790 1789
1791 # Define a writable temp dir that will be used as cwd while running 1790 # Define a writable temp dir that will be used as cwd while running
1792 # the tests. The name of the dir includes the pid to allow parallel 1791 # the tests. The name of the dir includes the pid to allow parallel
1793 # testing (see the -j option). 1792 # testing (see the -j option).
1794 TESTCWD = 'test_python_{}'.format(os.getpid()) 1793 TESTCWD = 'test_python_{}'.format(os.getpid())
1795 1794
(...skipping 23 matching lines...) Expand all
1819 assert __file__ == os.path.abspath(sys.argv[0]) 1818 assert __file__ == os.path.abspath(sys.argv[0])
1820 1819
1821 TEMPDIR, TESTCWD = _make_temp_dir_for_build(TEMPDIR) 1820 TEMPDIR, TESTCWD = _make_temp_dir_for_build(TEMPDIR)
1822 1821
1823 # Run the tests in a context manager that temporary changes the CWD to a 1822 # Run the tests in a context manager that temporary changes the CWD to a
1824 # temporary and writable directory. If it's not possible to create or 1823 # temporary and writable directory. If it's not possible to create or
1825 # change the CWD, the original CWD will be used. The original CWD is 1824 # change the CWD, the original CWD will be used. The original CWD is
1826 # available from support.SAVEDCWD. 1825 # available from support.SAVEDCWD.
1827 with support.temp_cwd(TESTCWD, quiet=True): 1826 with support.temp_cwd(TESTCWD, quiet=True):
1828 main() 1827 main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7