MCPcopy Index your code
hub / github.com/python/cpython / setUp

Method setUp

Lib/test/test_py_compile.py:267–277  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

265class PyCompileCLITestCase(unittest.TestCase):
266
267 def setUp(self):
268 self.directory = tempfile.mkdtemp()
269 self.source_path = os.path.join(self.directory, '_test.py')
270 try:
271 self.cache_path = importlib.util.cache_from_source(self.source_path,
272 optimization='' if __debug__ else 1)
273 except NotImplementedError:
274 # py_compile.main() assumes legacy pyc path if there is no cache_tag
275 self.cache_path = self.source_path + 'c'
276 with open(self.source_path, 'w') as file:
277 file.write('x = 123\n')
278
279 def tearDown(self):
280 os_helper.rmtree(self.directory)

Callers

nothing calls this directly

Calls 4

mkdtempMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected