FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-149879: Fix test_venv on Cygwin by vstinner · Pull Request #150426 · python/cpython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 8 additions & 1 deletion Lib/test/test_venv.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _check_output_of_default_create(self):
self.assertIn('home = %s' % path, data)
self.assertIn('executable = %s' %
os.path.realpath(sys.executable), data)
copies = '' if os.name=='nt' else ' --copies'
copies = '' if os.name=='nt' or sys.platform == 'cygwin' else ' --copies'
cmd = (f'command = {sys.executable} -m venv{copies} --without-pip '
f'--without-scm-ignore-files {self.env_dir}')
self.assertIn(cmd, data)
Expand Down Expand Up @@ -278,6 +278,8 @@ def test_prefixes(self):
pathlib.Path(expected), prefix)

@requireVenvCreate
@unittest.skipIf(sys.platform == 'cygwin',
'venv only works using symlinks on Cygwin')
def test_sysconfig(self):
"""
Test that the sysconfig functions work in a virtual environment.
Expand Down Expand Up @@ -714,6 +716,11 @@ def test_zippath_from_non_installed_posix(self):
os.mkdir(bindir)
python_exe = os.path.basename(sys.executable)
shutil.copy2(sys.executable, os.path.join(bindir, python_exe))
if sys.platform == 'cygwin':
exe_path = os.path.dirname(sys.executable)
libpython_dll = sysconfig.get_config_var('DLLLIBRARY')
shutil.copy2(os.path.join(exe_path, libpython_dll),
os.path.join(bindir, libpython_dll))
libdir = os.path.join(non_installed_dir, platlibdir, self.lib[1])
os.makedirs(libdir)
landmark = os.path.join(libdir, "os.py")
Expand Down
6 changes: 4 additions & 2 deletions Lib/venv/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ class EnvBuilder:
"""

def __init__(self, system_site_packages=False, clear=False,
symlinks=False, upgrade=False, with_pip=False, prompt=None,
symlinks=None, upgrade=False, with_pip=False, prompt=None,
upgrade_deps=False, *, scm_ignore_files=frozenset()):
if symlinks is None:
symlinks = (sys.platform == 'cygwin')
self.system_site_packages = system_site_packages
self.clear = clear
self.symlinks = symlinks
Expand Down Expand Up @@ -599,7 +601,7 @@ def upgrade_dependencies(self, context):


def create(env_dir, system_site_packages=False, clear=False,
symlinks=False, with_pip=False, prompt=None, upgrade_deps=False,
symlinks=None, with_pip=False, prompt=None, upgrade_deps=False,
*, scm_ignore_files=frozenset()):
"""Create a virtual environment in a directory."""
builder = EnvBuilder(system_site_packages=system_site_packages,
Expand Down
Loading

Back | FazBrowse Home | New Git URL