diff --git a/tests/unit/test_fsspec_streaming.py b/tests/unit/test_fsspec_streaming.py index 43d193b5..29d29ac1 100644 --- a/tests/unit/test_fsspec_streaming.py +++ b/tests/unit/test_fsspec_streaming.py @@ -1,16 +1,8 @@ import unittest - - -try: - import s3fs - import fsspec - - HAVE_FSSPEC = True -except ImportError: - HAVE_FSSPEC = False - - from hdmf_zarr import NWBZarrIO +from .utils import check_s3fs_ffspec_installed + +HAVE_FSSPEC = check_s3fs_ffspec_installed() class TestFSSpecStreaming(unittest.TestCase): diff --git a/tests/unit/utils.py b/tests/unit/utils.py index 67f2e8e0..ebc1f732 100644 --- a/tests/unit/utils.py +++ b/tests/unit/utils.py @@ -34,6 +34,16 @@ def get_temp_filepath(): return temp_file.name +def check_s3fs_ffspec_installed(): + """Check if s3fs and ffspec are installed required for streaming access from S3""" + try: + import s3fs # noqa F401 + import fsspec # noqa F401 + return True + except ImportError: + return False + + ############################################ # Foo example data containers and specs ###########################################