From 839e1b1316c62cfe5575ec20cc07312911a37814 Mon Sep 17 00:00:00 2001 From: Antonio Valentino Date: Sun, 8 Feb 2026 19:40:27 +0100 Subject: [PATCH] Improve detection of s3fs and skip tests requiring it --- upath/tests/implementations/test_s3.py | 1 + upath/tests/test_relative.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/upath/tests/implementations/test_s3.py b/upath/tests/implementations/test_s3.py index a7fcc5ad..226324e0 100644 --- a/upath/tests/implementations/test_s3.py +++ b/upath/tests/implementations/test_s3.py @@ -170,6 +170,7 @@ def test_pathlib_consistent_join(): def test_copy__object_key_collides_with_dir_prefix(s3_server, tmp_path): + pytest.importorskip("s3fs") anon, s3so = s3_server s3 = fsspec.filesystem("s3", anon=anon, **{**s3so, "use_listings_cache": False}) diff --git a/upath/tests/test_relative.py b/upath/tests/test_relative.py index 8d71bb45..266b610e 100644 --- a/upath/tests/test_relative.py +++ b/upath/tests/test_relative.py @@ -35,6 +35,10 @@ def test_protocol_storage_options_fs_preserved(protocol, storage_options, path, assert rel.protocol == protocol assert dict(**rel.storage_options) == storage_options + try: + rel.fs + except ImportError: + pytest.skip(reason=f"{protocol} not available") assert isinstance(rel.fs, type(p.fs))