@@ -167,6 +167,20 @@ def test_compile_file_pathlike_ddir(self):
167167 quiet = 2 ))
168168 self .assertTrue (os .path .isfile (self .bc_path ))
169169
170+ def test_compile_file_pathlike_stripdir (self ):
171+ self .assertFalse (os .path .isfile (self .bc_path ))
172+ self .assertTrue (compileall .compile_file (pathlib .Path (self .source_path ),
173+ stripdir = pathlib .Path ('stripdir_path' ),
174+ quiet = 2 ))
175+ self .assertTrue (os .path .isfile (self .bc_path ))
176+
177+ def test_compile_file_pathlike_prependdir (self ):
178+ self .assertFalse (os .path .isfile (self .bc_path ))
179+ self .assertTrue (compileall .compile_file (pathlib .Path (self .source_path ),
180+ prependdir = pathlib .Path ('prependdir_path' ),
181+ quiet = 2 ))
182+ self .assertTrue (os .path .isfile (self .bc_path ))
183+
170184 def test_compile_path (self ):
171185 with test .test_importlib .util .import_state (path = [self .directory ]):
172186 self .assertTrue (compileall .compile_path (quiet = 2 ))
@@ -219,6 +233,20 @@ def test_compile_dir_pathlike(self):
219233 self .assertRegex (line , r'Listing ([^WindowsPath|PosixPath].*)' )
220234 self .assertTrue (os .path .isfile (self .bc_path ))
221235
236+ def test_compile_dir_pathlike_stripdir (self ):
237+ self .assertFalse (os .path .isfile (self .bc_path ))
238+ self .assertTrue (compileall .compile_dir (pathlib .Path (self .directory ),
239+ stripdir = pathlib .Path ('stripdir_path' ),
240+ quiet = 2 ))
241+ self .assertTrue (os .path .isfile (self .bc_path ))
242+
243+ def test_compile_dir_pathlike_prependdir (self ):
244+ self .assertFalse (os .path .isfile (self .bc_path ))
245+ self .assertTrue (compileall .compile_dir (pathlib .Path (self .directory ),
246+ prependdir = pathlib .Path ('prependdir_path' ),
247+ quiet = 2 ))
248+ self .assertTrue (os .path .isfile (self .bc_path ))
249+
222250 @skipUnless (_have_multiprocessing , "requires multiprocessing" )
223251 @mock .patch ('concurrent.futures.ProcessPoolExecutor' )
224252 def test_compile_pool_called (self , pool_mock ):
0 commit comments