(self)
| 158 | self.assertTrue(os.path.exists(fn), 'File %r should exist.' % fn) |
| 159 | |
| 160 | def test_config_file_command_key(self): |
| 161 | options = [ |
| 162 | (None, None, None), # Default case. |
| 163 | ('--copies', 'symlinks', False), |
| 164 | ('--without-pip', 'with_pip', False), |
| 165 | ('--system-site-packages', 'system_site_packages', True), |
| 166 | ('--clear', 'clear', True), |
| 167 | ('--upgrade', 'upgrade', True), |
| 168 | ('--upgrade-deps', 'upgrade_deps', True), |
| 169 | ('--prompt="foobar"', 'prompt', 'foobar'), |
| 170 | ('--without-scm-ignore-files', 'scm_ignore_files', frozenset()), |
| 171 | ] |
| 172 | for opt, attr, value in options: |
| 173 | with self.subTest(opt=opt, attr=attr, value=value): |
| 174 | rmtree(self.env_dir) |
| 175 | if not attr: |
| 176 | kwargs = {} |
| 177 | else: |
| 178 | kwargs = {attr: value} |
| 179 | b = venv.EnvBuilder(**kwargs) |
| 180 | b.upgrade_dependencies = Mock() # avoid pip command to upgrade deps |
| 181 | b._setup_pip = Mock() # avoid pip setup |
| 182 | self.run_with_capture(b.create, self.env_dir) |
| 183 | data = self.get_text_file_contents('pyvenv.cfg') |
| 184 | if not attr or opt.endswith('git'): |
| 185 | for opt in ('--system-site-packages', '--clear', '--upgrade', |
| 186 | '--upgrade-deps', '--prompt'): |
| 187 | self.assertNotRegex(data, rf'command = .* {opt}') |
| 188 | elif os.name=='nt' and attr=='symlinks': |
| 189 | pass |
| 190 | else: |
| 191 | self.assertRegex(data, rf'command = .* {opt}') |
| 192 | |
| 193 | def test_prompt(self): |
| 194 | env_name = os.path.split(self.env_dir)[1] |
nothing calls this directly
no test coverage detected