mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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.
This commit is contained in:
parent
0e28d0f7a1
commit
1512d6c6ee
5 changed files with 59 additions and 56 deletions
|
@ -7,6 +7,7 @@ import socket
|
|||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import sysconfig
|
||||
import tempfile
|
||||
import textwrap
|
||||
import unittest
|
||||
|
@ -800,6 +801,27 @@ class TestSupport(unittest.TestCase):
|
|||
support.max_memuse = old_max_memuse
|
||||
support.real_max_memuse = old_real_max_memuse
|
||||
|
||||
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