Accepting request 839893 from devel:languages:python

- Update to 0.7.1:
  - async operations via aiohttp
- Add avoid_network_tests.patch to skip over network requiring
  test (gh#dask/gcsfs#292).

OBS-URL: https://build.opensuse.org/request/show/839893
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-gcsfs?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2020-10-07 12:18:27 +00:00 committed by Git OBS Bridge
commit dcb7f1497f
5 changed files with 481 additions and 7 deletions

460
avoid_network_tests.patch Normal file
View File

@ -0,0 +1,460 @@
---
gcsfs/tests/test_core.py | 44 ++++++++++++++++++++++++++++++++++++++++
gcsfs/tests/test_mapping.py | 10 +++++++++
setup.cfg | 6 -----
setup.cfg | 3 ++
4 files changed, 57 insertions(+), 6 deletions(-)
--- a/gcsfs/tests/test_mapping.py
+++ b/gcsfs/tests/test_mapping.py
@@ -15,6 +15,7 @@ def test_api():
assert "mapping" in dir(gcsfs)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_simple():
with gcs_maker() as gcs:
@@ -26,6 +27,7 @@ def test_map_simple():
assert list(d.items()) == []
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_default_gcsfilesystem():
with gcs_maker() as gcs:
@@ -33,6 +35,7 @@ def test_map_default_gcsfilesystem():
assert d.fs is gcs
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_errors():
with gcs_maker() as gcs:
@@ -69,6 +72,7 @@ def test_map_with_data():
assert list(d) == []
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_complex_keys():
with gcs_maker() as gcs:
@@ -87,6 +91,7 @@ def test_map_complex_keys():
assert ("x", 1, 2) in d
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_clear_empty():
with gcs_maker() as gcs:
@@ -100,6 +105,7 @@ def test_map_clear_empty():
assert list(d) == []
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_pickle():
with gcs_maker() as gcs:
@@ -114,6 +120,7 @@ def test_map_pickle():
assert d2["x"] == b"1"
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_array():
with gcs_maker() as gcs:
@@ -125,6 +132,7 @@ def test_map_array():
assert d["x"] == b"A" * 1000
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_bytearray():
with gcs_maker() as gcs:
@@ -134,6 +142,7 @@ def test_map_bytearray():
assert d["x"] == b"123"
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_new_bucket():
with gcs_maker() as gcs:
@@ -156,6 +165,7 @@ def test_new_bucket():
gcs.rmdir(new_bucket)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_map_pickle():
import pickle
--- a/setup.cfg
+++ b/setup.cfg
@@ -27,3 +27,6 @@ max-line-length = 120
tag_build =
tag_date = 0
+[tool:pytest]
+markers =
+ network: marks tests which require network connection
--- a/gcsfs/tests/test_core.py
+++ b/gcsfs/tests/test_core.py
@@ -63,6 +63,7 @@ def test_many_connect():
pool.join()
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_simple_upload():
with gcs_maker() as gcs:
@@ -115,6 +116,7 @@ def test_multi_upload():
assert gcs.info(fn)["contentType"] == "application/octet-stream"
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_info():
with gcs_maker() as gcs:
@@ -122,6 +124,7 @@ def test_info():
assert gcs.info(a) == gcs.ls(a, detail=True)[0]
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_ls2():
with gcs_maker() as gcs:
@@ -133,6 +136,7 @@ def test_ls2():
assert fn in gcs.ls(TEST_BUCKET + "/test")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_pickle():
import pickle
@@ -158,6 +162,7 @@ def test_pickle():
assert gcs.ls(TEST_BUCKET) == gcs2.ls(TEST_BUCKET)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_ls_touch():
with gcs_maker() as gcs:
@@ -173,6 +178,7 @@ def test_ls_touch():
assert set(d["name"] for d in L_d) == set([a, b])
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_rm():
with gcs_maker() as gcs:
@@ -188,6 +194,7 @@ def test_rm():
gcs.rm("nonexistent")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_rm_batch():
with gcs_maker() as gcs:
@@ -200,6 +207,7 @@ def test_rm_batch():
assert b not in gcs.find(TEST_BUCKET)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_rm_recursive():
files = ["/a", "/a/b", "/a/c"]
@@ -210,6 +218,7 @@ def test_rm_recursive():
assert not gcs.exists(TEST_BUCKET + files[-1])
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_file_access():
with gcs_maker() as gcs:
@@ -223,6 +232,7 @@ def test_file_access():
assert gcs.tail(fn, 10000) == data
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_file_info():
with gcs_maker() as gcs:
@@ -238,6 +248,7 @@ def test_file_info():
gcs.info(fn + "another")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_du():
with gcs_maker(True) as gcs:
@@ -250,6 +261,7 @@ def test_du():
)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_ls():
with gcs_maker(True) as gcs:
@@ -261,6 +273,7 @@ def test_ls():
assert fn in gcs.ls(TEST_BUCKET + "/nested")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_ls_detail():
with gcs_maker(True) as gcs:
@@ -268,6 +281,7 @@ def test_ls_detail():
assert all(isinstance(item, dict) for item in L)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_gcs_glob():
with gcs_maker(True) as gcs:
@@ -286,6 +300,7 @@ def test_gcs_glob():
)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_read_keys_from_bucket():
with gcs_maker(True) as gcs:
@@ -300,6 +315,7 @@ def test_read_keys_from_bucket():
)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_url():
with gcs_maker(True) as gcs:
@@ -311,6 +327,7 @@ def test_url():
assert "http" in f.url()
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_seek():
with gcs_maker(True) as gcs:
@@ -340,6 +357,7 @@ def test_seek():
assert f.seek(i) == i
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_bad_open():
with gcs_maker() as gcs:
@@ -347,6 +365,7 @@ def test_bad_open():
gcs.open("")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_copy():
with gcs_maker(True) as gcs:
@@ -355,6 +374,7 @@ def test_copy():
assert gcs.cat(fn) == gcs.cat(fn + "2")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_move():
with gcs_maker(True) as gcs:
@@ -414,6 +434,7 @@ def test_get_put_recursive(protocol):
)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_errors():
with gcs_maker() as gcs:
@@ -451,6 +472,7 @@ def test_errors():
assert "bucket" in str(e)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_read_small():
with gcs_maker(True) as gcs:
@@ -467,6 +489,7 @@ def test_read_small():
assert len(f.cache.cache) < len(out)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_seek_delimiter():
with gcs_maker(True) as gcs:
@@ -486,6 +509,7 @@ def test_seek_delimiter():
assert f.tell() == ind + 1
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_read_block():
with gcs_maker(True) as gcs:
@@ -504,6 +528,7 @@ def test_read_block():
assert gcs.read_block(path, 5, None) == gcs.read_block(path, 5, 1000)
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_flush():
with gcs_maker() as gcs:
@@ -524,6 +549,7 @@ def test_flush():
wo.write(b"abc")
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_write_fails():
with gcs_maker() as gcs:
@@ -555,6 +581,7 @@ def text_mode():
assert f.read() == text
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_write_blocks():
with gcs_maker() as gcs:
@@ -568,6 +595,7 @@ def test_write_blocks():
assert gcs.info(TEST_BUCKET + "/temp")["size"] == 300000
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_write_blocks2():
with gcs_maker() as gcs:
@@ -578,6 +606,7 @@ def test_write_blocks2():
assert gcs.info(TEST_BUCKET + "/temp1")["size"] == 2 ** 18 + 1
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_readline():
with gcs_maker(True) as gcs:
@@ -591,6 +620,7 @@ def test_readline():
assert result == expected
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_readline_from_cache():
with gcs_maker() as gcs:
@@ -615,6 +645,7 @@ def test_readline_from_cache():
assert f.cache.cache == data
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_readline_empty():
with gcs_maker() as gcs:
@@ -626,6 +657,7 @@ def test_readline_empty():
assert result == data
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_readline_blocksize():
with gcs_maker() as gcs:
@@ -646,6 +678,7 @@ def test_readline_blocksize():
assert result == expected
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_next():
with gcs_maker(True) as gcs:
@@ -655,6 +688,7 @@ def test_next():
assert result == expected
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_iterable():
with gcs_maker() as gcs:
@@ -678,6 +712,7 @@ def test_iterable():
assert b"".join(out) == data
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_readable():
with gcs_maker() as gcs:
@@ -688,6 +723,7 @@ def test_readable():
assert f.readable()
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_seekable():
with gcs_maker() as gcs:
@@ -698,6 +734,7 @@ def test_seekable():
assert f.seekable()
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_writable():
with gcs_maker() as gcs:
@@ -708,6 +745,7 @@ def test_writable():
assert not f.writable()
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_merge():
with gcs_maker() as gcs:
@@ -720,6 +758,7 @@ def test_merge():
assert gcs.info(TEST_BUCKET + "/joined")["size"] == 20
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_bigger_than_block_read():
with gcs_maker(True) as gcs:
@@ -733,6 +772,7 @@ def test_bigger_than_block_read():
assert b"".join(out) == csv_files["2014-01-01.csv"]
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_current():
with gcs_maker() as gcs:
@@ -741,6 +781,7 @@ def test_current():
assert gcs2.session is gcs.session
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_array():
with gcs_maker() as gcs:
@@ -756,6 +797,7 @@ def test_array():
assert out == b"A" * 1000
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_attrs():
with gcs_maker() as gcs:
@@ -778,6 +820,7 @@ def test_attrs():
assert gcs.getxattr(a, "something") == "not"
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_request_user_project():
with gcs_maker():
@@ -797,6 +840,7 @@ def test_request_user_project():
assert result["userProject"] == [TEST_PROJECT]
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_request_user_project_string():
with gcs_maker():
@@ -819,6 +863,7 @@ def test_request_user_project_string():
assert result["userProject"] == [TEST_PROJECT]
+@pytest.mark.network
@my_vcr.use_cassette(match=["all"])
def test_request_header():
with gcs_maker():

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e9845e3b8b24d18218c0f7bbdb2a9a315a47b9b6388bcaea025ab3449c17161
size 204788

3
gcsfs-0.7.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03658dfbf1a734d987aab3631e0a342b3d7e24a24998b4d8d2491fdd21053720
size 183232

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Oct 6 19:15:04 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Update to 0.7.1:
- async operations via aiohttp
- Add avoid_network_tests.patch to skip over network requiring
test (gh#dask/gcsfs#292).
-------------------------------------------------------------------
Mon Apr 6 13:52:50 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>

View File

@ -19,18 +19,22 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-gcsfs
Version: 0.6.1
Version: 0.7.1
Release: 0
Summary: Filesystem interface over GCS
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/dask/gcsfs
Source: https://files.pythonhosted.org/packages/source/g/gcsfs/gcsfs-%{version}.tar.gz
# PATCH-FIX-UPSTREAM avoid_network_tests.patch gh#dask/gcsfs#292 mcepl@suse.com
# skip tests which require network connection
Patch0: avoid_network_tests.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-aiohttp
Requires: python-decorator
Requires: python-fsspec >= 0.6.0
Requires: python-fsspec >= 0.8.0
Requires: python-google-auth >= 1.2
Requires: python-google-auth-oauthlib
Requires: python-requests
@ -38,9 +42,10 @@ Recommends: dask
Recommends: python-gcsfs-fuse = %{version}
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module aiohttp}
BuildRequires: %{python_module click}
BuildRequires: %{python_module decorator}
BuildRequires: %{python_module fsspec >= 0.6.0}
BuildRequires: %{python_module fsspec >= 0.8.0}
BuildRequires: %{python_module fusepy}
BuildRequires: %{python_module google-auth >= 1.2}
BuildRequires: %{python_module google-auth-oauthlib}
@ -69,6 +74,7 @@ This package provides the optional FUSE interface.
%prep
%setup -q -n gcsfs-%{version}
%autopatch -p1
%build
%python_build
@ -79,7 +85,7 @@ This package provides the optional FUSE interface.
%check
# Tests test_map_simple, test_map_with_data and test_map_clear_empty require a network connection
%pytest -k "not (test_map_simple or test_map_with_data or test_map_clear_empty)" gcsfs
%pytest -k "not network" gcsfs/tests
%files %{python_files}
%doc README.rst