aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_compileall.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index 73c83c9bf1e..05154c8f1c6 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -167,6 +167,20 @@ class CompileallTestsBase:
quiet=2))
self.assertTrue(os.path.isfile(self.bc_path))
+ def test_compile_file_pathlike_stripdir(self):
+ self.assertFalse(os.path.isfile(self.bc_path))
+ self.assertTrue(compileall.compile_file(pathlib.Path(self.source_path),
+ stripdir=pathlib.Path('stripdir_path'),
+ quiet=2))
+ self.assertTrue(os.path.isfile(self.bc_path))
+
+ def test_compile_file_pathlike_prependdir(self):
+ self.assertFalse(os.path.isfile(self.bc_path))
+ self.assertTrue(compileall.compile_file(pathlib.Path(self.source_path),
+ prependdir=pathlib.Path('prependdir_path'),
+ quiet=2))
+ self.assertTrue(os.path.isfile(self.bc_path))
+
def test_compile_path(self):
with test.test_importlib.util.import_state(path=[self.directory]):
self.assertTrue(compileall.compile_path(quiet=2))
@@ -219,6 +233,20 @@ class CompileallTestsBase:
self.assertRegex(line, r'Listing ([^WindowsPath|PosixPath].*)')
self.assertTrue(os.path.isfile(self.bc_path))
+ def test_compile_dir_pathlike_stripdir(self):
+ self.assertFalse(os.path.isfile(self.bc_path))
+ self.assertTrue(compileall.compile_dir(pathlib.Path(self.directory),
+ stripdir=pathlib.Path('stripdir_path'),
+ quiet=2))
+ self.assertTrue(os.path.isfile(self.bc_path))
+
+ def test_compile_dir_pathlike_prependdir(self):
+ self.assertFalse(os.path.isfile(self.bc_path))
+ self.assertTrue(compileall.compile_dir(pathlib.Path(self.directory),
+ prependdir=pathlib.Path('prependdir_path'),
+ quiet=2))
+ self.assertTrue(os.path.isfile(self.bc_path))
+
@skipUnless(_have_multiprocessing, "requires multiprocessing")
@mock.patch('concurrent.futures.ProcessPoolExecutor')
def test_compile_pool_called(self, pool_mock):