Test that the template strings are quoted properly (csh)
(self)
| 529 | @unittest.skipIf(sys.platform.startswith('netbsd'), |
| 530 | "NetBSD csh fails with quoted special chars; see gh-139308") |
| 531 | def test_special_chars_csh(self): |
| 532 | """ |
| 533 | Test that the template strings are quoted properly (csh) |
| 534 | """ |
| 535 | rmtree(self.env_dir) |
| 536 | csh = shutil.which('tcsh') or shutil.which('csh') |
| 537 | if csh is None: |
| 538 | self.skipTest('csh required for this test') |
| 539 | env_name = '"\';&&$e|\'"' |
| 540 | env_dir = os.path.join(os.path.realpath(self.env_dir), env_name) |
| 541 | builder = venv.EnvBuilder(clear=True) |
| 542 | builder.create(env_dir) |
| 543 | activate = os.path.join(env_dir, self.bindir, 'activate.csh') |
| 544 | test_script = os.path.join(self.env_dir, 'test_special_chars.csh') |
| 545 | with open(test_script, "w") as f: |
| 546 | f.write(f'source {shlex.quote(activate)}\n' |
| 547 | 'python -c \'import sys; print(sys.executable)\'\n' |
| 548 | 'python -c \'import os; print(os.environ["VIRTUAL_ENV"])\'\n' |
| 549 | 'deactivate\n') |
| 550 | out, err = check_output([csh, test_script]) |
| 551 | lines = out.splitlines() |
| 552 | self.assertTrue(env_name.encode() in lines[0]) |
| 553 | self.assertEndsWith(lines[1], env_name.encode()) |
| 554 | |
| 555 | # gh-124651: test quoted strings on Windows |
| 556 | @unittest.skipUnless(os.name == 'nt', 'only relevant on Windows') |
nothing calls this directly
no test coverage detected