171171if not Path .exists (Path (_gridfs_dest_base )):
172172 Path .mkdir (Path (_gridfs_dest_base ))
173173
174- async_files = [
175- _pymongo_base + str (f )
176- for f in Path .iterdir (Path (_pymongo_base ))
177- if (Path (_pymongo_base ) / f ).is_file ()
178- ]
174+ async_files = [_pymongo_base + f .name for f in Path (_pymongo_base ).iterdir () if f .is_file ()]
179175
180- gridfs_files = [
181- _gridfs_base + str (f )
182- for f in Path .iterdir (Path (_gridfs_base ))
183- if (Path (_gridfs_base ) / f ).is_file ()
184- ]
176+ gridfs_files = [_gridfs_base + f .name for f in Path (_gridfs_base ).iterdir () if f .is_file ()]
185177
186178
187179def async_only_test (f : Path ) -> bool :
188180 """Return True for async tests that should not be converted to sync."""
189- return str ( f ) in [
181+ return f . name in [
190182 "test_locks.py" ,
191183 "test_concurrency.py" ,
192184 "test_async_cancellation.py" ,
@@ -197,9 +189,9 @@ def async_only_test(f: Path) -> bool:
197189
198190
199191test_files = [
200- _test_base + str ( f )
201- for f in Path . iterdir ( Path ( _test_base ))
202- if ( Path ( _test_base ) / f ) .is_file () and not async_only_test (f )
192+ _test_base + f . name
193+ for f in Path ( _test_base ). iterdir ( )
194+ if f .is_file () and not async_only_test (f )
203195]
204196
205197# Add each asynchronized test here as part of the converting PR
@@ -453,15 +445,11 @@ def main() -> None:
453445 unasync_directory (test_files , _test_base , _test_dest_base , replacements )
454446
455447 sync_files = [
456- _pymongo_dest_base + str (f )
457- for f in Path .iterdir (Path (_pymongo_dest_base ))
458- if (Path (_pymongo_dest_base ) / f ).is_file ()
448+ _pymongo_dest_base + f .name for f in Path (_pymongo_dest_base ).iterdir () if f .is_file ()
459449 ]
460450
461451 sync_gridfs_files = [
462- _gridfs_dest_base + str (f )
463- for f in Path .iterdir (Path (_gridfs_dest_base ))
464- if (Path (_gridfs_dest_base ) / f ).is_file ()
452+ _gridfs_dest_base + f .name for f in Path (_gridfs_dest_base ).iterdir () if f .is_file ()
465453 ]
466454 sync_test_files = [
467455 _test_dest_base + f for f in converted_tests if (Path (_test_dest_base ) / f ).is_file ()
0 commit comments