(self, should_exist=True)
| 77 | os.chdir(self.cwd_drive) |
| 78 | |
| 79 | def assert_cache_path_exists(self, should_exist=True): |
| 80 | if self.cache_path: |
| 81 | if should_exist: |
| 82 | self.assertTrue(os.path.exists(self.cache_path)) |
| 83 | else: |
| 84 | self.assertFalse(os.path.exists(self.cache_path)) |
| 85 | return |
| 86 | cache_dir = os.path.join(self.directory, '__pycache__') |
| 87 | if not os.path.isdir(cache_dir): |
| 88 | if should_exist: |
| 89 | self.fail('no __pycache__ directory exists') |
| 90 | return |
| 91 | for f in os.listdir(cache_dir): |
| 92 | if f.startswith('_test.') and f.endswith('.pyc'): |
| 93 | if should_exist: |
| 94 | return |
| 95 | self.fail(f'__pycache__/{f} was created') |
| 96 | else: |
| 97 | if should_exist: |
| 98 | self.fail('no __pycache__/_test.*.pyc file exists') |
| 99 | |
| 100 | def test_absolute_path(self): |
| 101 | py_compile.compile(self.source_path, self.pyc_path) |
no test coverage detected