diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c00ef57f3..a0a43c908 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -109,7 +109,7 @@ jobs: - name: Run fsspec tests shell: bash -l {0} run: | - pytest -v fsspec/tests/test_downstream.py + pytest -v tests/test_downstream.py - name: Run dask tests shell: bash -l {0} diff --git a/pyproject.toml b/pyproject.toml index 8a77470fe..1938a40d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -141,9 +141,6 @@ raw-options = { 'version_scheme' = 'post-release' } [tool.hatch.build.hooks.vcs] version-file = "fsspec/_version.py" -[tool.hatch.build] -exclude = ["**/tests/*", "!**/tests/abstract/"] - [tool.ruff] exclude = [".tox", "build", "docs/source/conf.py", "fsspec/_version"] line-length = 88 diff --git a/fsspec/implementations/tests/__init__.py b/tests/__init__.py similarity index 100% rename from fsspec/implementations/tests/__init__.py rename to tests/__init__.py diff --git a/fsspec/tests/conftest.py b/tests/conftest.py similarity index 98% rename from fsspec/tests/conftest.py rename to tests/conftest.py index 0a56521ed..1febe062b 100644 --- a/fsspec/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,8 @@ import pytest +from fsspec.conftest import ftp_writable, instance_caches, m # noqa: F401 + requests = pytest.importorskip("requests") data = b"\n".join([b"some test data"] * 1000) listing = open( diff --git a/fsspec/tests/data/listing.html b/tests/data/listing.html similarity index 100% rename from fsspec/tests/data/listing.html rename to tests/data/listing.html diff --git a/fsspec/implementations/tests/local/__init__.py b/tests/implementations/__init__.py similarity index 100% rename from fsspec/implementations/tests/local/__init__.py rename to tests/implementations/__init__.py diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_listing.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_listing.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_listing.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_listing.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_mkdir.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_mkdir.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_mkdir.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_mkdir.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_read_pyarrow_non_partitioned.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_read_range.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_read_range.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_read_range_chunked.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_and_read.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_write_and_read.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_and_read.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_write_and_read.yaml diff --git a/fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml b/tests/implementations/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml similarity index 100% rename from fsspec/implementations/tests/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml rename to tests/implementations/cassettes/test_dbfs/test_dbfs_write_pyarrow_non_partitioned.yaml diff --git a/fsspec/implementations/tests/conftest.py b/tests/implementations/conftest.py similarity index 100% rename from fsspec/implementations/tests/conftest.py rename to tests/implementations/conftest.py diff --git a/fsspec/implementations/tests/ftp_tls.py b/tests/implementations/ftp_tls.py similarity index 100% rename from fsspec/implementations/tests/ftp_tls.py rename to tests/implementations/ftp_tls.py diff --git a/fsspec/implementations/tests/ftp_tlsv12.py b/tests/implementations/ftp_tlsv12.py similarity index 100% rename from fsspec/implementations/tests/ftp_tlsv12.py rename to tests/implementations/ftp_tlsv12.py diff --git a/fsspec/implementations/tests/keycert.pem b/tests/implementations/keycert.pem similarity index 100% rename from fsspec/implementations/tests/keycert.pem rename to tests/implementations/keycert.pem diff --git a/fsspec/implementations/tests/memory/__init__.py b/tests/implementations/local/__init__.py similarity index 100% rename from fsspec/implementations/tests/memory/__init__.py rename to tests/implementations/local/__init__.py diff --git a/fsspec/implementations/tests/local/local_fixtures.py b/tests/implementations/local/local_fixtures.py similarity index 100% rename from fsspec/implementations/tests/local/local_fixtures.py rename to tests/implementations/local/local_fixtures.py diff --git a/fsspec/implementations/tests/local/local_test.py b/tests/implementations/local/local_test.py similarity index 77% rename from fsspec/implementations/tests/local/local_test.py rename to tests/implementations/local/local_test.py index 6f23e7ae5..98af92991 100644 --- a/fsspec/implementations/tests/local/local_test.py +++ b/tests/implementations/local/local_test.py @@ -1,5 +1,6 @@ import fsspec.tests.abstract as abstract -from fsspec.implementations.tests.local.local_fixtures import LocalFixtures + +from .local_fixtures import LocalFixtures class TestLocalCopy(abstract.AbstractCopyTests, LocalFixtures): diff --git a/tests/implementations/memory/__init__.py b/tests/implementations/memory/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/fsspec/implementations/tests/memory/memory_fixtures.py b/tests/implementations/memory/memory_fixtures.py similarity index 100% rename from fsspec/implementations/tests/memory/memory_fixtures.py rename to tests/implementations/memory/memory_fixtures.py diff --git a/fsspec/implementations/tests/memory/memory_test.py b/tests/implementations/memory/memory_test.py similarity index 84% rename from fsspec/implementations/tests/memory/memory_test.py rename to tests/implementations/memory/memory_test.py index c165d4d82..12545e73c 100644 --- a/fsspec/implementations/tests/memory/memory_test.py +++ b/tests/implementations/memory/memory_test.py @@ -1,5 +1,6 @@ import fsspec.tests.abstract as abstract -from fsspec.implementations.tests.memory.memory_fixtures import MemoryFixtures + +from .memory_fixtures import MemoryFixtures class TestMemoryCopy(abstract.AbstractCopyTests, MemoryFixtures): diff --git a/fsspec/implementations/tests/out.zip b/tests/implementations/out.zip similarity index 100% rename from fsspec/implementations/tests/out.zip rename to tests/implementations/out.zip diff --git a/fsspec/implementations/tests/test_archive.py b/tests/implementations/test_archive.py similarity index 100% rename from fsspec/implementations/tests/test_archive.py rename to tests/implementations/test_archive.py diff --git a/fsspec/implementations/tests/test_arrow.py b/tests/implementations/test_arrow.py similarity index 100% rename from fsspec/implementations/tests/test_arrow.py rename to tests/implementations/test_arrow.py diff --git a/fsspec/implementations/tests/test_asyn_wrapper.py b/tests/implementations/test_asyn_wrapper.py similarity index 100% rename from fsspec/implementations/tests/test_asyn_wrapper.py rename to tests/implementations/test_asyn_wrapper.py diff --git a/fsspec/implementations/tests/test_cached.py b/tests/implementations/test_cached.py similarity index 99% rename from fsspec/implementations/tests/test_cached.py rename to tests/implementations/test_cached.py index 3a4727902..8919efb69 100644 --- a/fsspec/implementations/tests/test_cached.py +++ b/tests/implementations/test_cached.py @@ -20,8 +20,8 @@ ) from fsspec.implementations.local import make_path_posix from fsspec.implementations.zip import ZipFileSystem -from fsspec.tests.conftest import win +from ..conftest import win from .test_ftp import FTPFileSystem diff --git a/fsspec/implementations/tests/test_common.py b/tests/implementations/test_common.py similarity index 93% rename from fsspec/implementations/tests/test_common.py rename to tests/implementations/test_common.py index f09f13ce0..0f4622a81 100644 --- a/fsspec/implementations/tests/test_common.py +++ b/tests/implementations/test_common.py @@ -4,7 +4,8 @@ import pytest from fsspec import AbstractFileSystem -from fsspec.implementations.tests.conftest import READ_ONLY_FILESYSTEMS + +from .conftest import READ_ONLY_FILESYSTEMS @pytest.mark.parametrize("fs", ["local"], indirect=["fs"]) diff --git a/fsspec/implementations/tests/test_dask.py b/tests/implementations/test_dask.py similarity index 100% rename from fsspec/implementations/tests/test_dask.py rename to tests/implementations/test_dask.py diff --git a/fsspec/implementations/tests/test_data.py b/tests/implementations/test_data.py similarity index 100% rename from fsspec/implementations/tests/test_data.py rename to tests/implementations/test_data.py diff --git a/fsspec/implementations/tests/test_dbfs.py b/tests/implementations/test_dbfs.py similarity index 100% rename from fsspec/implementations/tests/test_dbfs.py rename to tests/implementations/test_dbfs.py diff --git a/fsspec/implementations/tests/test_dirfs.py b/tests/implementations/test_dirfs.py similarity index 100% rename from fsspec/implementations/tests/test_dirfs.py rename to tests/implementations/test_dirfs.py diff --git a/fsspec/implementations/tests/test_ftp.py b/tests/implementations/test_ftp.py similarity index 100% rename from fsspec/implementations/tests/test_ftp.py rename to tests/implementations/test_ftp.py diff --git a/fsspec/implementations/tests/test_gist.py b/tests/implementations/test_gist.py similarity index 100% rename from fsspec/implementations/tests/test_gist.py rename to tests/implementations/test_gist.py diff --git a/fsspec/implementations/tests/test_git.py b/tests/implementations/test_git.py similarity index 100% rename from fsspec/implementations/tests/test_git.py rename to tests/implementations/test_git.py diff --git a/fsspec/implementations/tests/test_github.py b/tests/implementations/test_github.py similarity index 100% rename from fsspec/implementations/tests/test_github.py rename to tests/implementations/test_github.py diff --git a/fsspec/implementations/tests/test_http.py b/tests/implementations/test_http.py similarity index 99% rename from fsspec/implementations/tests/test_http.py rename to tests/implementations/test_http.py index e27ce359e..58803690b 100644 --- a/fsspec/implementations/tests/test_http.py +++ b/tests/implementations/test_http.py @@ -9,9 +9,9 @@ import pytest import fsspec.asyn -import fsspec.utils from fsspec.implementations.http import HTTPStreamFile -from fsspec.tests.conftest import data, reset_files, server, win # noqa: F401 + +from ..conftest import data, reset_files, server, win # noqa: F401 def test_list(server): diff --git a/fsspec/implementations/tests/test_http_sync.py b/tests/implementations/test_http_sync.py similarity index 99% rename from fsspec/implementations/tests/test_http_sync.py rename to tests/implementations/test_http_sync.py index b7f8fbe0f..22771ba6e 100644 --- a/fsspec/implementations/tests/test_http_sync.py +++ b/tests/implementations/test_http_sync.py @@ -6,7 +6,8 @@ import pytest import fsspec.utils -from fsspec.tests.conftest import data, requests, reset_files, server, win # noqa: F401 + +from ..conftest import data, requests, reset_files, server, win # noqa: F401 @pytest.fixture() diff --git a/fsspec/implementations/tests/test_jupyter.py b/tests/implementations/test_jupyter.py similarity index 100% rename from fsspec/implementations/tests/test_jupyter.py rename to tests/implementations/test_jupyter.py diff --git a/fsspec/implementations/tests/test_libarchive.py b/tests/implementations/test_libarchive.py similarity index 92% rename from fsspec/implementations/tests/test_libarchive.py rename to tests/implementations/test_libarchive.py index a5bef340b..d2b1d6999 100644 --- a/fsspec/implementations/tests/test_libarchive.py +++ b/tests/implementations/test_libarchive.py @@ -1,7 +1,8 @@ # this test case checks that the libarchive can be used from a seekable source (any fs # with a block cache active) import fsspec -from fsspec.implementations.tests.test_archive import archive_data, temparchive + +from .test_archive import archive_data, temparchive def test_cache(ftp_writable): diff --git a/fsspec/implementations/tests/test_local.py b/tests/implementations/test_local.py similarity index 99% rename from fsspec/implementations/tests/test_local.py rename to tests/implementations/test_local.py index d74b168d9..c5c94ec20 100644 --- a/fsspec/implementations/tests/test_local.py +++ b/tests/implementations/test_local.py @@ -17,7 +17,8 @@ from fsspec import compression from fsspec.core import OpenFile, get_fs_token_paths, open_files from fsspec.implementations.local import LocalFileSystem, get_umask, make_path_posix -from fsspec.tests.test_utils import WIN + +from ..test_utils import WIN files = { ".test.accounts.1.json": ( diff --git a/fsspec/implementations/tests/test_memory.py b/tests/implementations/test_memory.py similarity index 100% rename from fsspec/implementations/tests/test_memory.py rename to tests/implementations/test_memory.py diff --git a/fsspec/implementations/tests/test_reference.py b/tests/implementations/test_reference.py similarity index 99% rename from fsspec/implementations/tests/test_reference.py rename to tests/implementations/test_reference.py index e1d73f19a..1425b9902 100644 --- a/fsspec/implementations/tests/test_reference.py +++ b/tests/implementations/test_reference.py @@ -10,7 +10,8 @@ ReferenceFileSystem, ReferenceNotReachable, ) -from fsspec.tests.conftest import data, reset_files, server, win # noqa: F401 + +from ..conftest import data, reset_files, server, win # noqa: F401 def test_simple(server): diff --git a/fsspec/implementations/tests/test_sftp.py b/tests/implementations/test_sftp.py similarity index 100% rename from fsspec/implementations/tests/test_sftp.py rename to tests/implementations/test_sftp.py diff --git a/fsspec/implementations/tests/test_smb.py b/tests/implementations/test_smb.py similarity index 100% rename from fsspec/implementations/tests/test_smb.py rename to tests/implementations/test_smb.py diff --git a/fsspec/implementations/tests/test_tar.py b/tests/implementations/test_tar.py similarity index 99% rename from fsspec/implementations/tests/test_tar.py rename to tests/implementations/test_tar.py index 2ead3096f..f30831f07 100644 --- a/fsspec/implementations/tests/test_tar.py +++ b/tests/implementations/test_tar.py @@ -13,7 +13,8 @@ from fsspec.core import OpenFile from fsspec.implementations.cached import WholeFileCacheFileSystem from fsspec.implementations.tar import TarFileSystem -from fsspec.implementations.tests.test_archive import archive_data, temptar + +from .test_archive import archive_data, temptar if TYPE_CHECKING: from pathlib import Path diff --git a/fsspec/implementations/tests/test_webhdfs.py b/tests/implementations/test_webhdfs.py similarity index 100% rename from fsspec/implementations/tests/test_webhdfs.py rename to tests/implementations/test_webhdfs.py diff --git a/fsspec/implementations/tests/test_zip.py b/tests/implementations/test_zip.py similarity index 99% rename from fsspec/implementations/tests/test_zip.py rename to tests/implementations/test_zip.py index 74696ee2c..fe883868a 100644 --- a/fsspec/implementations/tests/test_zip.py +++ b/tests/implementations/test_zip.py @@ -7,9 +7,10 @@ import pytest import fsspec -from fsspec.implementations.tests.test_archive import archive_data, tempzip from fsspec.implementations.zip import ZipFileSystem +from .test_archive import archive_data, tempzip + def test_info(): with tempzip(archive_data) as z: diff --git a/fsspec/tests/test_api.py b/tests/test_api.py similarity index 100% rename from fsspec/tests/test_api.py rename to tests/test_api.py diff --git a/fsspec/tests/test_async.py b/tests/test_async.py similarity index 100% rename from fsspec/tests/test_async.py rename to tests/test_async.py diff --git a/fsspec/tests/test_cache_threads.py b/tests/test_cache_threads.py similarity index 100% rename from fsspec/tests/test_cache_threads.py rename to tests/test_cache_threads.py diff --git a/fsspec/tests/test_caches.py b/tests/test_caches.py similarity index 100% rename from fsspec/tests/test_caches.py rename to tests/test_caches.py diff --git a/fsspec/tests/test_callbacks.py b/tests/test_callbacks.py similarity index 100% rename from fsspec/tests/test_callbacks.py rename to tests/test_callbacks.py diff --git a/fsspec/tests/test_chained.py b/tests/test_chained.py similarity index 100% rename from fsspec/tests/test_chained.py rename to tests/test_chained.py diff --git a/fsspec/tests/test_compression.py b/tests/test_compression.py similarity index 100% rename from fsspec/tests/test_compression.py rename to tests/test_compression.py diff --git a/fsspec/tests/test_config.py b/tests/test_config.py similarity index 100% rename from fsspec/tests/test_config.py rename to tests/test_config.py diff --git a/fsspec/tests/test_core.py b/tests/test_core.py similarity index 100% rename from fsspec/tests/test_core.py rename to tests/test_core.py diff --git a/fsspec/tests/test_downstream.py b/tests/test_downstream.py similarity index 100% rename from fsspec/tests/test_downstream.py rename to tests/test_downstream.py diff --git a/fsspec/tests/test_file.py b/tests/test_file.py similarity index 98% rename from fsspec/tests/test_file.py rename to tests/test_file.py index 784f50753..d2666e928 100644 --- a/fsspec/tests/test_file.py +++ b/tests/test_file.py @@ -4,7 +4,7 @@ import pytest -from fsspec.implementations.tests.test_ftp import FTPFileSystem +from .implementations.test_ftp import FTPFileSystem data = b"hello" * 10000 diff --git a/fsspec/tests/test_fuse.py b/tests/test_fuse.py similarity index 100% rename from fsspec/tests/test_fuse.py rename to tests/test_fuse.py diff --git a/fsspec/tests/test_generic.py b/tests/test_generic.py similarity index 98% rename from fsspec/tests/test_generic.py rename to tests/test_generic.py index 6e2ba0469..8614abe5f 100644 --- a/fsspec/tests/test_generic.py +++ b/tests/test_generic.py @@ -1,7 +1,8 @@ import pytest import fsspec -from fsspec.tests.conftest import data, server # noqa: F401 + +from .conftest import data, server # noqa: F401 def test_remote_async_ops(server): diff --git a/fsspec/tests/test_gui.py b/tests/test_gui.py similarity index 100% rename from fsspec/tests/test_gui.py rename to tests/test_gui.py diff --git a/fsspec/tests/test_mapping.py b/tests/test_mapping.py similarity index 100% rename from fsspec/tests/test_mapping.py rename to tests/test_mapping.py diff --git a/fsspec/tests/test_parquet.py b/tests/test_parquet.py similarity index 100% rename from fsspec/tests/test_parquet.py rename to tests/test_parquet.py diff --git a/fsspec/tests/test_registry.py b/tests/test_registry.py similarity index 100% rename from fsspec/tests/test_registry.py rename to tests/test_registry.py diff --git a/fsspec/tests/test_spec.py b/tests/test_spec.py similarity index 99% rename from fsspec/tests/test_spec.py rename to tests/test_spec.py index 7fc828243..16cc0332b 100644 --- a/fsspec/tests/test_spec.py +++ b/tests/test_spec.py @@ -15,7 +15,8 @@ from fsspec.implementations.http import HTTPFileSystem from fsspec.implementations.local import LocalFileSystem from fsspec.spec import AbstractBufferedFile, AbstractFileSystem -from fsspec.tests.conftest import data + +from .conftest import data PATHS_FOR_GLOB_TESTS = ( {"name": "test0.json", "type": "file", "size": 100}, @@ -1039,10 +1040,14 @@ def test_serialize_with_password(): def test_from_dict_valid(): - fs = DummyTestFS.from_dict({"cls": "fsspec.tests.test_spec.DummyTestFS"}) + fs = DummyTestFS.from_dict( + {"cls": f"{test_from_dict_valid.__module__}.DummyTestFS"} + ) assert isinstance(fs, DummyTestFS) - fs = DummyTestFS.from_dict({"cls": "fsspec.tests.test_spec.DummyTestFS", "bar": 1}) + fs = DummyTestFS.from_dict( + {"cls": f"{test_from_dict_valid.__module__}.DummyTestFS", "bar": 1} + ) assert fs.storage_options["bar"] == 1 fs = DummyTestFS.from_dict({"cls": "fsspec.implementations.local.LocalFileSystem"}) diff --git a/fsspec/tests/test_utils.py b/tests/test_utils.py similarity index 100% rename from fsspec/tests/test_utils.py rename to tests/test_utils.py