Test that the template strings are quoted properly on Windows
(self)
| 555 | # gh-124651: test quoted strings on Windows |
| 556 | @unittest.skipUnless(os.name == 'nt', 'only relevant on Windows') |
| 557 | def test_special_chars_windows(self): |
| 558 | """ |
| 559 | Test that the template strings are quoted properly on Windows |
| 560 | """ |
| 561 | rmtree(self.env_dir) |
| 562 | env_name = "'&&^$e" |
| 563 | env_dir = os.path.join(os.path.realpath(self.env_dir), env_name) |
| 564 | builder = venv.EnvBuilder(clear=True) |
| 565 | builder.create(env_dir) |
| 566 | activate = os.path.join(env_dir, self.bindir, 'activate.bat') |
| 567 | test_batch = os.path.join(self.env_dir, 'test_special_chars.bat') |
| 568 | with open(test_batch, "w") as f: |
| 569 | f.write('@echo off\n' |
| 570 | f'"{activate}" & ' |
| 571 | f'{self.exe} -c "import sys; print(sys.executable)" & ' |
| 572 | f'{self.exe} -c "import os; print(os.environ[\'VIRTUAL_ENV\'])" & ' |
| 573 | 'deactivate') |
| 574 | out, err = check_output([test_batch]) |
| 575 | lines = out.splitlines() |
| 576 | self.assertTrue(env_name.encode() in lines[0]) |
| 577 | self.assertEndsWith(lines[1], env_name.encode()) |
| 578 | |
| 579 | @unittest.skipUnless(os.name == 'nt', 'only relevant on Windows') |
| 580 | def test_unicode_in_batch_file(self): |
nothing calls this directly
no test coverage detected