mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-109615: Fix test_tools.test_freeze SRCDIR (#109935)
Fix copy_source_tree() function of test_tools.test_freeze:
* Don't copy SRC_DIR/build/ anymore. This directory is modified by
other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
(cherry picked from commit 1512d6c6ee
)
This commit is contained in:
parent
d951aaea97
commit
2423168604
5 changed files with 58 additions and 56 deletions
|
@ -7,6 +7,7 @@ import socket
|
|||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import sysconfig
|
||||
import tempfile
|
||||
import textwrap
|
||||
import time
|
||||
|
@ -777,6 +778,27 @@ class TestSupport(unittest.TestCase):
|
|||
|
||||
#self.assertEqual(available, 2)
|
||||
|
||||
def test_copy_python_src_ignore(self):
|
||||
src_dir = sysconfig.get_config_var('srcdir')
|
||||
src_dir = os.path.abspath(src_dir)
|
||||
|
||||
ignored = {'.git', '__pycache__'}
|
||||
|
||||
# Source code directory
|
||||
names = os.listdir(src_dir)
|
||||
self.assertEqual(support.copy_python_src_ignore(src_dir, names),
|
||||
ignored | {'build'})
|
||||
|
||||
# Doc/ directory
|
||||
path = os.path.join(src_dir, 'Doc')
|
||||
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
||||
ignored | {'build', 'venv'})
|
||||
|
||||
# An other directory
|
||||
path = os.path.join(src_dir, 'Objects')
|
||||
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
|
||||
ignored)
|
||||
|
||||
# XXX -follows a list of untested API
|
||||
# make_legacy_pyc
|
||||
# is_resource_enabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue