MCPcopy Index your code
hub / github.com/RustPython/RustPython / create_package

Function create_package

Lib/test/test_modulefinder.py:300–316  ·  view source on GitHub ↗
(test_dir, source)

Source from the content-addressed store, hash-verified

298
299
300def create_package(test_dir, source):
301 ofi = None
302 try:
303 for line in source.splitlines():
304 if type(line) != bytes:
305 line = line.encode('utf-8')
306 if line.startswith(b' ') or line.startswith(b'\t'):
307 ofi.write(line.strip() + b'\n')
308 else:
309 if ofi:
310 ofi.close()
311 if type(line) == bytes:
312 line = line.decode('utf-8')
313 ofi = open_file(os.path.join(test_dir, line.strip()))
314 finally:
315 if ofi:
316 ofi.close()
317
318class ModuleFinderTest(unittest.TestCase):
319 def setUp(self):

Callers 1

_do_testMethod · 0.70

Calls 9

open_fileFunction · 0.85
splitlinesMethod · 0.45
encodeMethod · 0.45
startswithMethod · 0.45
writeMethod · 0.45
stripMethod · 0.45
closeMethod · 0.45
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected