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

Method test_compile_files

Lib/test/test_compileall.py:130–153  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 self.recreation_check(b'\0\0\0\0')
129
130 def test_compile_files(self):
131 # Test compiling a single file, and complete directory
132 for fn in (self.bc_path, self.bc_path2):
133 try:
134 os.unlink(fn)
135 except:
136 pass
137 self.assertTrue(compileall.compile_file(self.source_path,
138 force=False, quiet=True))
139 self.assertTrue(os.path.isfile(self.bc_path) and
140 not os.path.isfile(self.bc_path2))
141 os.unlink(self.bc_path)
142 self.assertTrue(compileall.compile_dir(self.directory, force=False,
143 quiet=True))
144 self.assertTrue(os.path.isfile(self.bc_path) and
145 os.path.isfile(self.bc_path2))
146 os.unlink(self.bc_path)
147 os.unlink(self.bc_path2)
148 # Test against bad files
149 self.add_bad_source_file()
150 self.assertFalse(compileall.compile_file(self.bad_source_path,
151 force=False, quiet=2))
152 self.assertFalse(compileall.compile_dir(self.directory,
153 force=False, quiet=2))
154
155 def test_compile_file_pathlike(self):
156 self.assertFalse(os.path.isfile(self.bc_path))

Callers

nothing calls this directly

Calls 6

add_bad_source_fileMethod · 0.95
assertTrueMethod · 0.80
assertFalseMethod · 0.80
unlinkMethod · 0.45
isfileMethod · 0.45
compile_dirMethod · 0.45

Tested by

no test coverage detected