diff --git a/satpy/tests/reader_tests/test_hdf5_utils.py b/satpy/tests/reader_tests/test_hdf5_utils.py index f04bd58fa5..828bae566d 100644 --- a/satpy/tests/reader_tests/test_hdf5_utils.py +++ b/satpy/tests/reader_tests/test_hdf5_utils.py @@ -27,20 +27,21 @@ def __init__(self, filename, filename_info, filetype_info, **kwargs): if HDF5FileHandler is object: raise ImportError("Base 'HDF5FileHandler' could not be " "imported.") + filename = str(filename) super(HDF5FileHandler, self).__init__(filename, filename_info, filetype_info) self.file_content = self.get_test_content(filename, filename_info, filetype_info) self.file_content.update(kwargs) def get_test_content(self, filename, filename_info, filetype_info): """Mimic reader input file content - + Args: - filename (str): input filename + filename (str): input filename filename_info (dict): Dict of metadata pulled from filename filetype_info (dict): Dict of metadata from the reader's yaml config for this file type Returns: dict of file content with keys like: - + - 'dataset' - '/attr/global_attr' - 'dataset/attr/global_attr' diff --git a/satpy/tests/test_readers.py b/satpy/tests/test_readers.py index 15e7a7ec8d..59ef452c36 100644 --- a/satpy/tests/test_readers.py +++ b/satpy/tests/test_readers.py @@ -212,7 +212,7 @@ def tearDown(self): def test_no_args(self): """Test no args provided. - + This should check the local directory which should have no files. """ from satpy.readers import load_readers @@ -243,6 +243,17 @@ def test_bad_reader_name_with_filenames(self): 'SVI01_npp_d20120225_t1801245_e1802487_b01708_c20120226002130255476_noaa_ops.h5', ]) + def test_filenames_as_path(self): + """Test with filenames specified as pathlib.Path""" + if sys.version_info < (3, 4): + return + from pathlib import Path + from satpy.readers import load_readers + ri = load_readers(filenames=[ + Path('SVI01_npp_d20120225_t1801245_e1802487_b01708_c20120226002130255476_noaa_ops.h5'), + ]) + self.assertListEqual(list(ri.keys()), ['viirs_sdr']) + def test_filenames_as_dict(self): """Test loading readers where filenames are organized by reader""" from satpy.readers import load_readers