@@ -133,6 +133,31 @@ def test_defaults_with_pathlike(self):
133133 self .run_with_capture (venv .create , FakePath (self .env_dir ))
134134 self ._check_output_of_default_create ()
135135
136+ def test_envbuilder_symlinks (self ):
137+ for kwargs , expected in (
138+ ({}, os .name != 'nt' ),
139+ ({'symlinks' : None }, os .name != 'nt' ),
140+ ({'symlinks' : True }, True ),
141+ ({'symlinks' : False }, False ),
142+ ):
143+ with self .subTest (kwargs = kwargs ):
144+ builder = venv .EnvBuilder (** kwargs )
145+ self .assertIs (builder .symlinks , expected )
146+
147+ def test_create_symlinks (self ):
148+ for kwargs , expected in (
149+ ({}, os .name != 'nt' ),
150+ ({'symlinks' : None }, os .name != 'nt' ),
151+ ({'symlinks' : True }, True ),
152+ ({'symlinks' : False }, False ),
153+ ):
154+ with self .subTest (kwargs = kwargs ):
155+ with patch .object (venv .EnvBuilder , 'create' , autospec = True ) as create :
156+ venv .create (self .env_dir , ** kwargs )
157+ builder , env_dir = create .call_args .args
158+ self .assertIs (builder .symlinks , expected )
159+ self .assertEqual (env_dir , self .env_dir )
160+
136161 def _check_output_of_default_create (self ):
137162 self .isdir (self .bindir )
138163 self .isdir (self .include )
@@ -146,8 +171,7 @@ def _check_output_of_default_create(self):
146171 self .assertIn ('home = %s' % path , data )
147172 self .assertIn ('executable = %s' %
148173 os .path .realpath (sys .executable ), data )
149- copies = '' if os .name == 'nt' else ' --copies'
150- cmd = (f'command = { sys .executable } -m venv{ copies } --without-pip '
174+ cmd = (f'command = { sys .executable } -m venv --without-pip '
151175 f'--without-scm-ignore-files { self .env_dir } ' )
152176 self .assertIn (cmd , data )
153177 fn = self .get_env_file (self .bindir , self .exe )
@@ -156,6 +180,7 @@ def _check_output_of_default_create(self):
156180 print ('Contents of %r:' % bd )
157181 print (' %r' % os .listdir (bd ))
158182 self .assertTrue (os .path .exists (fn ), 'File %r should exist.' % fn )
183+ self .assertEqual (os .path .islink (fn ), os .name != 'nt' and can_symlink ())
159184
160185 def test_config_file_command_key (self ):
161186 options = [
0 commit comments