diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index d9a76fe97f813..3cd9d9cdd67d2 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -3,6 +3,7 @@ from distutils.version import LooseVersion from io import BytesIO import os +from pathlib import Path import re from warnings import catch_warnings, simplefilter @@ -4594,12 +4595,9 @@ def test_read_nokey_empty(self, setup_path): with pytest.raises(ValueError): read_hdf(path) - @td.skip_if_no("pathlib") def test_read_from_pathlib_path(self, setup_path): # GH11773 - from pathlib import Path - expected = DataFrame( np.random.rand(4, 5), index=list("abcd"), columns=list("ABCDE") ) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index e37561c865c7a..49af18d2935ef 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -1,5 +1,6 @@ import io import os +from pathlib import Path import numpy as np import pytest @@ -68,10 +69,7 @@ def test_from_iterator(self): tm.assert_frame_equal(df, df0.iloc[2:5, :]) rdr.close() - @td.skip_if_no("pathlib") def test_path_pathlib(self): - from pathlib import Path - for j in 0, 1: df0 = self.data[j] for k in self.test_ix[j]: diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index a15eac89ecedb..d2633ea0676cd 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -4,6 +4,7 @@ from io import StringIO import mmap import os +from pathlib import Path import pytest @@ -27,14 +28,7 @@ def __fspath__(self): # Functions that consume a string path and return a string or path-like object -path_types = [str, CustomFSPath] - -try: - from pathlib import Path - - path_types.append(Path) -except ImportError: - pass +path_types = [str, CustomFSPath, Path] try: from py.path import local as LocalPath @@ -73,7 +67,6 @@ def test_expand_user_normal_path(self): assert expanded_name == filename assert os.path.expanduser(filename) == expanded_name - @td.skip_if_no("pathlib") def test_stringify_path_pathlib(self): rel_path = icom._stringify_path(Path(".")) assert rel_path == "."