Adjust and restore sys.pycache_prefix.
(self)
| 542 | |
| 543 | @contextlib.contextmanager |
| 544 | def temporary_pycache_prefix(self): |
| 545 | """Adjust and restore sys.pycache_prefix.""" |
| 546 | old_prefix = sys.pycache_prefix |
| 547 | new_prefix = os.path.join(self.directory, '__testcache__') |
| 548 | try: |
| 549 | sys.pycache_prefix = new_prefix |
| 550 | yield { |
| 551 | 'PYTHONPATH': self.directory, |
| 552 | 'PYTHONPYCACHEPREFIX': new_prefix, |
| 553 | } |
| 554 | finally: |
| 555 | sys.pycache_prefix = old_prefix |
| 556 | |
| 557 | def _get_run_args(self, args): |
| 558 | return [*support.optim_args_from_interpreter_flags(), |
no test coverage detected