(self, testcase: DataDrivenTestCase)
| 177 | self.run_case_inner(testcase) |
| 178 | |
| 179 | def run_case_inner(self, testcase: DataDrivenTestCase) -> None: |
| 180 | if not os.path.isdir(WORKDIR): # (one test puts something in build...) |
| 181 | os.mkdir(WORKDIR) |
| 182 | |
| 183 | text = "\n".join(testcase.input) |
| 184 | |
| 185 | with open("native.py", "w", encoding="utf-8") as f: |
| 186 | f.write(text) |
| 187 | with open("interpreted.py", "w", encoding="utf-8") as f: |
| 188 | f.write(text) |
| 189 | |
| 190 | shutil.copyfile(TESTUTIL_PATH, "testutil.py") |
| 191 | |
| 192 | step = 1 |
| 193 | self.run_case_step(testcase, step) |
| 194 | |
| 195 | steps = testcase.find_steps() |
| 196 | if steps == [[]]: |
| 197 | steps = [] |
| 198 | |
| 199 | for operations in steps: |
| 200 | # To make sure that any new changes get picked up as being |
| 201 | # new by distutils, shift the mtime of all of the |
| 202 | # generated artifacts back by a second. |
| 203 | fudge_dir_mtimes(WORKDIR, -1) |
| 204 | # On some OS, changing the mtime doesn't work reliably. As |
| 205 | # a workaround, sleep. |
| 206 | # TODO: Figure out a better approach, since this slows down tests. |
| 207 | time.sleep(1.0) |
| 208 | |
| 209 | step += 1 |
| 210 | with chdir_manager(".."): |
| 211 | perform_file_operations(operations) |
| 212 | self.run_case_step(testcase, step) |
| 213 | |
| 214 | def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) -> None: |
| 215 | benchmark_build = has_test_name_tag(testcase.name, "benchmark") |
no test coverage detected