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

Method test_compile_files

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected