Skip to content

Commit

Permalink
rename network -> requires_network to be more consistent with other t…
Browse files Browse the repository at this point in the history
…est decorators
  • Loading branch information
TomNicholas committed Dec 21, 2024
1 parent 498565e commit ff64960
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
3 changes: 2 additions & 1 deletion virtualizarr/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from virtualizarr.manifests.manifest import join
from virtualizarr.zarr import ZArray, ceildiv

network = pytest.mark.network
# TODO rename to requires_network?
requires_network = pytest.mark.network


def _importorskip(
Expand Down
6 changes: 3 additions & 3 deletions virtualizarr/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from virtualizarr.readers.hdf import HDFVirtualBackend
from virtualizarr.tests import (
has_astropy,
network,
requires_kerchunk,
requires_network,
requires_s3fs,
requires_scipy,
)
Expand Down Expand Up @@ -193,7 +193,7 @@ def test_var_attr_coords(self, netcdf4_file_with_2d_coords):
assert set(vds.coords) == set(expected_coords)


@network
@requires_network
@requires_s3fs
class TestReadFromS3:
@pytest.mark.parametrize(
Expand All @@ -216,7 +216,7 @@ def test_anon_read_s3(self, indexes, hdf_backend):
assert isinstance(vds[var].data, ManifestArray), var


@network
@requires_network
@pytest.mark.parametrize("hdf_backend", [HDF5VirtualBackend, HDFVirtualBackend])
class TestReadFromURL:
@pytest.mark.parametrize(
Expand Down
4 changes: 2 additions & 2 deletions virtualizarr/tests/test_readers/test_dmrpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from virtualizarr import open_virtual_dataset
from virtualizarr.manifests.manifest import ChunkManifest
from virtualizarr.readers.dmrpp import DMRParser
from virtualizarr.tests import network
from virtualizarr.tests import requires_network

urls = [
(
Expand Down Expand Up @@ -177,7 +177,7 @@ def dmrparser(dmrpp_xml_str: str, tmp_path: Path, filename="test.nc") -> DMRPars
)


@network
@requires_network
@pytest.mark.parametrize("data_url, dmrpp_url", urls)
@pytest.mark.skip(reason="Fill_val mismatch")
def test_NASA_dmrpp(data_url, dmrpp_url):
Expand Down
18 changes: 8 additions & 10 deletions virtualizarr/tests/test_readers/test_fits.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import pytest

from xarray import Dataset

from virtualizarr import open_virtual_dataset
from virtualizarr.tests import network, requires_kerchunk

from virtualizarr.tests import requires_kerchunk, requires_network

pytest.importorskip("astropy")


@requires_kerchunk
@network
@requires_network
def test_open_hubble_data():
# data from https://registry.opendata.aws/hst/
vds = open_virtual_dataset(
"s3://stpubdata/hst/public/f05i/f05i0201m/f05i0201m_a1f.fits",
reader_options={'storage_options': {'anon': True}}
reader_options={"storage_options": {"anon": True}},
)

assert isinstance(vds, Dataset)
assert list(vds.variables) == ['PRIMARY']
var = vds['PRIMARY'].variable
assert var.sizes == {'y': 17, 'x': 589}
assert var.dtype == '>i4'
assert list(vds.variables) == ["PRIMARY"]
var = vds["PRIMARY"].variable
assert var.sizes == {"y": 17, "x": 589}
assert var.dtype == ">i4"

0 comments on commit ff64960

Please sign in to comment.