Skip to content

Commit

Permalink
fix: running from venv
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Sep 28, 2024
1 parent 7b564b9 commit ca424f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Lib/test/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,30 +817,30 @@ def test_executable_symlink(self):
@requires_subprocess()
@unittest.skipIf(os.name == 'nt', 'not relevant on Windows')
@unittest.skipUnless(can_symlink(), 'Needs symlinks')
@requireVenvCreate
def test_tree_symlink(self):
"""
Test creation using a symlink to python tree.
"""
rmtree(self.env_dir)
executable_abspath = os.path.abspath(sys.executable)
tree_abspath = os.path.dirname(
os.path.dirname(executable_abspath))
executable_abspath = os.path.abspath(sys._base_executable)
tree_abspath = os.path.dirname(os.path.dirname(executable_abspath))
with tempfile.TemporaryDirectory() as symlink_dir:
tree_symlink = os.path.join(
os.path.realpath(symlink_dir),
os.path.basename(tree_abspath))
executable_symlink = os.path.join(
tree_symlink,
os.path.basename(os.path.dirname(executable_abspath)),
os.path.basename(sys.executable))
os.path.basename(sys._base_executable))
os.symlink(tree_abspath, tree_symlink)
cmd = [executable_symlink, "-m", "venv", "--without-pip",
self.env_dir]
subprocess.check_call(cmd)
data = self.get_text_file_contents('pyvenv.cfg')
self.assertIn('home = %s' % tree_symlink, data)
self.assertIn('executable = %s' %
os.path.realpath(sys.executable), data)
os.path.realpath(sys._base_executable), data)

@requireVenvCreate
class EnsurePipTest(BaseTest):
Expand Down

0 comments on commit ca424f1

Please sign in to comment.