Lines Matching refs:path
57 self.source_path = os.path.join(self.directory, '_test.py')
61 self.source_path2 = os.path.join(self.directory, '_test2.py')
64 self.subdirectory = os.path.join(self.directory, '_subdir')
66 self.source_path3 = os.path.join(self.subdirectory, '_test3.py')
73 self.bad_source_path = os.path.join(self.directory, '_test_bad.py')
139 self.assertTrue(os.path.isfile(self.bc_path) and
140 not os.path.isfile(self.bc_path2))
144 self.assertTrue(os.path.isfile(self.bc_path) and
145 os.path.isfile(self.bc_path2))
156 self.assertFalse(os.path.isfile(self.bc_path))
161 self.assertTrue(os.path.isfile(self.bc_path))
164 self.assertFalse(os.path.isfile(self.bc_path))
168 self.assertTrue(os.path.isfile(self.bc_path))
171 self.assertFalse(os.path.isfile(self.bc_path))
175 self.assertTrue(os.path.isfile(self.bc_path))
178 self.assertFalse(os.path.isfile(self.bc_path))
182 self.assertTrue(os.path.isfile(self.bc_path))
185 with test.test_importlib.util.import_state(path=[self.directory]):
188 with test.test_importlib.util.import_state(path=[self.directory]):
196 data_dir = os.path.join(self.directory, 'data')
197 data_file = os.path.join(data_dir, 'file')
203 self.assertFalse(os.path.exists(os.path.join(data_dir, '__pycache__')))
220 self.assertTrue(os.path.isfile(cached))
223 self.assertTrue(os.path.isfile(cached2))
226 self.assertTrue(os.path.isfile(cached3))
229 self.assertFalse(os.path.isfile(self.bc_path))
234 self.assertTrue(os.path.isfile(self.bc_path))
237 self.assertFalse(os.path.isfile(self.bc_path))
241 self.assertTrue(os.path.isfile(self.bc_path))
244 self.assertFalse(os.path.isfile(self.bc_path))
248 self.assertTrue(os.path.isfile(self.bc_path))
285 path = self.directory
287 path = os.path.join(path, f"dir_{i}")
288 source = os.path.join(path, 'script.py')
289 os.mkdir(path)
294 self.assertFalse(os.path.isfile(pyc_filename))
297 self.assertTrue(os.path.isfile(pyc_filename))
302 path = self.directory
305 path = os.path.join(path, subdir)
306 os.mkdir(path)
307 script_helper.make_script(path, "__init__", "")
308 mods.append(script_helper.make_script(path, "mod",
319 expected_in = os.path.join(ddir, modpath)
343 fullpath = ["test", "build", "real", "path"]
344 path = os.path.join(self.directory, *fullpath)
345 os.makedirs(path)
346 script = script_helper.make_script(path, "test", "1 / 0")
348 stripdir = os.path.join(self.directory, *fullpath[:2])
349 compileall.compile_dir(path, quiet=True, stripdir=stripdir)
351 expected_in = os.path.join(*fullpath[2:])
362 fullpath = ["test", "build", "real", "path"]
363 path = os.path.join(self.directory, *fullpath)
364 os.makedirs(path)
365 script = script_helper.make_script(path, "test", "1 / 0")
368 compileall.compile_dir(path, quiet=True, prependdir=prependdir)
370 expected_in = os.path.join(prependdir, self.directory, *fullpath)
377 fullpath = ["test", "build", "real", "path"]
378 path = os.path.join(self.directory, *fullpath)
379 os.makedirs(path)
380 script = script_helper.make_script(path, "test", "1 / 0")
382 stripdir = os.path.join(self.directory, *fullpath[:2])
384 compileall.compile_dir(path, quiet=True,
387 expected_in = os.path.join(prependdir, *fullpath[2:])
398 fullpath = ["test", "build", "real", "path", "ddir"]
399 path = os.path.join(self.directory, *fullpath)
400 os.makedirs(path)
401 script_helper.make_script(path, "test", "1 / 0")
403 compileall.compile_dir(path, quiet=True, ddir="/bar",
419 self.assertTrue(os.path.isfile(bc[opt_level]))
428 allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
429 symlinks_path = os.path.join(self.directory, "test", "dir", "symlinks")
430 prohibited_path = os.path.join(self.directory, "test", "dir", "prohibited")
438 allowed_symlink = os.path.join(symlinks_path, "test_allowed.py")
439 prohibited_symlink = os.path.join(symlinks_path, "test_prohibited.py")
447 self.assertTrue(os.path.isfile(allowed_bc))
448 self.assertFalse(os.path.isfile(prohibited_bc))
474 self.source_path = os.path.join(self.directory, '_test.py')
497 self.pkgdir = os.path.join(self.directory, 'foo')
499 self.pkgdir_cachedir = os.path.join(self.pkgdir, '__pycache__')
508 new_prefix = os.path.join(self.directory, '__testcache__')
537 path = importlib.util.cache_from_source(fn)
538 self.assertTrue(os.path.exists(path))
541 path = importlib.util.cache_from_source(fn)
542 self.assertFalse(os.path.exists(path))
590 self.assertTrue(os.path.exists(self.pkgdir_cachedir))
604 self.assertFalse(os.path.exists(self.pkgdir_cachedir))
614 self.assertTrue(os.path.exists(self.pkgdir_cachedir))
615 cachecachedir = os.path.join(self.pkgdir_cachedir, '__pycache__')
616 self.assertFalse(os.path.exists(cachecachedir))
619 self.assertTrue(os.path.exists(self.pkgdir_cachedir))
620 self.assertFalse(os.path.exists(cachecachedir))
639 subpackage = os.path.join(self.pkgdir, 'spam')
645 self.assertFalse(os.path.exists(os.path.join(subpackage, '__pycache__')))
651 subpackage = os.path.join(self.pkgdir, 'spam')
652 subpackage2 = os.path.join(subpackage, 'ham')
653 subpackage3 = os.path.join(subpackage2, 'eggs')
657 subinitfn = os.path.join(subpackage, '__init__.py')
665 os.path.exists(os.path.join(subpackage, '__pycache__')))
689 pkg = os.path.join(self.pkgdir, 'spam')
691 os.symlink('.', os.path.join(pkg, 'evil'))
692 os.symlink('.', os.path.join(pkg, 'evil2'))
694 self.assertCompiled(os.path.join(
717 pkgdir2 = os.path.join(self.directory, 'foo2')
737 os.rename(pyc, os.path.join(self.pkgdir, 'baz.pyc'))
744 '-i', os.path.join(self.directory, 'nosuchfile'), self.pkgdir)
747 self.assertFalse(os.path.exists(importlib.util.cache_from_source(
755 with open(os.path.join(self.directory, 'l1'), 'w', encoding="utf-8") as l1:
756 l1.write(os.path.join(self.pkgdir, 'f1.py')+os.linesep)
757 l1.write(os.path.join(self.pkgdir, 'f2.py')+os.linesep)
758 self.assertRunOK('-i', os.path.join(self.directory, 'l1'), f4)
769 with open(os.path.join(self.directory, 'l1'), 'w', encoding="utf-8") as l1:
770 l1.write(os.path.join(self.pkgdir, 'f2.py')+os.linesep)
771 self.assertRunOK('-i', os.path.join(self.directory, 'l1'))
806 os.path.join(self.pkgdir, 'f1.py'))
821 pkgdir = os.path.join(self.directory, 'foo{}'.format(suffix))
840 fullpath = ["test", "build", "real", "path"]
841 path = os.path.join(self.directory, *fullpath)
842 os.makedirs(path)
843 script = script_helper.make_script(path, "test", "1 / 0")
845 stripdir = os.path.join(self.directory, *fullpath[:2])
847 self.assertRunOK("-s", stripdir, "-p", prependdir, path)
849 expected_in = os.path.join(prependdir, *fullpath[2:])
860 path = os.path.join(self.directory, "optimizations")
861 os.makedirs(path)
862 script = script_helper.make_script(path,
874 self.assertRunOK(path, *("-o" + str(n) for n in opt_combination))
876 self.assertTrue(os.path.isfile(bc[int(opt_level)]))
885 allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
886 symlinks_path = os.path.join(self.directory, "test", "dir", "symlinks")
887 prohibited_path = os.path.join(self.directory, "test", "dir", "prohibited")
895 allowed_symlink = os.path.join(symlinks_path, "test_allowed.py")
896 prohibited_symlink = os.path.join(symlinks_path, "test_prohibited.py")
904 self.assertTrue(os.path.isfile(allowed_bc))
905 self.assertFalse(os.path.isfile(prohibited_bc))
919 with tempfile.TemporaryDirectory() as path:
921 script = script_helper.make_script(path, "script", "a = 0")
927 self.assertRunOK(path, *args)
954 self.path = None
958 with tempfile.TemporaryDirectory() as path:
959 self.path = path
960 yield path
961 self.path = None
964 return script_helper.make_script(self.path, name, code)
967 compileall.compile_dir(self.path, quiet=True, optimize=optimize,
976 compileall.compile_dir(self.path, quiet=True, optimize=0,
981 compileall.compile_dir(self.path, quiet=True, optimize=[0, 0],
1096 "-O", "-c", "import module", __isolated=False, PYTHONPATH=self.path