MCPcopy Index your code
hub / github.com/python/mypy / run_case_inner

Method run_case_inner

mypyc/test/test_run.py:179–212  ·  view source on GitHub ↗
(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

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")

Callers 1

run_caseMethod · 0.95

Calls 8

run_case_stepMethod · 0.95
fudge_dir_mtimesFunction · 0.90
perform_file_operationsFunction · 0.90
chdir_managerFunction · 0.85
find_stepsMethod · 0.80
isdirMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected