@@ -1377,29 +1377,28 @@ def test_glob_posix_rules(path, expected, glob_fs):
13771377 assert info == glob_fs [name ]
13781378
13791379
1380- class CustomLocalFS (LocalFileSystem ):
1381- def ls (self , * args , ** kwargs ):
1382- files = super ().ls (* args , ** kwargs )
1383- limit = kwargs .pop ("limit" , None )
1380+ @pytest .fixture (scope = "function" )
1381+ def tmpfs (tmpdir ):
1382+ get_files (tmpdir )
13841383
1385- return files [:limit ] if limit else files
1384+ class CustomLocalFS (LocalFileSystem ):
1385+ def ls (self , * args , ** kwargs ):
1386+ files = super ().ls (* args , ** kwargs )
1387+ limit = kwargs .pop ("limit" , None )
13861388
1389+ return files [:limit ] if limit else files
13871390
1388- def test_cat_wildcard_path_passthrough_kwargs_to_ls (tmpdir ):
1389- test_fs = CustomLocalFS ()
1390- get_files (tmpdir )
1391+ return CustomLocalFS (auto_mkdir = True )
13911392
1392- file_contents = test_fs .cat (tmpdir / "*" , limit = 2 )
13931393
1394+ def test_cat_wildcard_path_passthrough_kwargs_to_ls (tmpfs , tmpdir ):
1395+ file_contents = tmpfs .cat (tmpdir / "*" , limit = 2 )
13941396 assert len (file_contents ) == 2
13951397
13961398
1397- def test_get_wildcard_path_passthrough_kwargs_to_ls (tmpdir ):
1398- test_fs = CustomLocalFS (auto_mkdir = True )
1399+ def test_get_wildcard_path_passthrough_kwargs_to_ls (tmpfs , tmpdir ):
13991400 dest = tmpdir / "dest"
1400- get_files (tmpdir )
1401-
1402- test_fs .get (tmpdir / "*" , str (dest ), limit = 2 )
1401+ tmpfs .get (tmpdir / "*" , str (dest ), limit = 2 )
14031402
14041403 assert len (dest .listdir ()) == 2
14051404
@@ -1410,30 +1409,20 @@ def test_get_wildcard_path_passthrough_kwargs_to_ls(tmpdir):
14101409 "implementation is not called"
14111410 )
14121411)
1413- def test_put_wildcard_path_passthrough_kwargs_to_ls (tmpdir ):
1414- test_fs = CustomLocalFS (auto_mkdir = True )
1412+ def test_put_wildcard_path_passthrough_kwargs_to_ls (tmpfs , tmpdir ):
14151413 dest = tmpdir / "dest"
1416- get_files (tmpdir )
1417-
1418- test_fs .put (tmpdir / "*" , str (dest ), limit = 2 )
1414+ tmpfs .put (tmpdir / "*" , str (dest ), limit = 2 )
14191415
14201416 assert len (dest .listdir ()) == 2
14211417
14221418
1423- def test_copy_wildcard_path_passthrough_kwargs_to_ls (tmpdir ):
1424- test_fs = CustomLocalFS (auto_mkdir = True )
1419+ def test_copy_wildcard_path_passthrough_kwargs_to_ls (tmpfs , tmpdir ):
14251420 dest = tmpdir / "dest"
1426- get_files (tmpdir )
1427-
1428- test_fs .copy (tmpdir / "*" , str (dest ), limit = 2 )
1421+ tmpfs .copy (tmpdir / "*" , str (dest ), limit = 2 )
14291422
14301423 assert len (dest .listdir ()) == 2
14311424
14321425
1433- def test_expand_path_wildcard_path_passthrough_kwargs_to_ls (tmpdir ):
1434- test_fs = CustomLocalFS ()
1435- get_files (tmpdir )
1436-
1437- expanded_paths = test_fs .expand_path (tmpdir / "*" , limit = 2 )
1438-
1426+ def test_expand_path_wildcard_path_passthrough_kwargs_to_ls (tmpfs , tmpdir ):
1427+ expanded_paths = tmpfs .expand_path (tmpdir / "*" , limit = 2 )
14391428 assert len (expanded_paths ) == 2
0 commit comments