use presence of auth kwargs as skip trigger in fixture test
MODIFY
tests/test_fixtures.py
tests/test_fixtures.py
import fsspec
import pytest
-import requests
import xarray as xr
from pangeo_forge_recipes.utils import fix_scalar_attr_encoding
@@ -15,8 +14,10 @@ def test_fixture_local_files(daily_xarray_dataset, netcdf_paths):
def test_fixture_http_files(daily_xarray_dataset, netcdf_http_paths):
urls = netcdf_http_paths[0]
- r = requests.get(urls[0])
- if r.status_code == 400 or r.status_code == 401:
+ if (
+ "auth" in netcdf_http_paths[-1]["fsspec_open_kwargs"].keys()
+ or netcdf_http_paths[-1]["query_string_secrets"].keys()
+ ):
pytest.skip("Authentication and required query strings are tested in test_storage.py")
open_files = [fsspec.open(url).open() for url in urls]
ds = xr.open_mfdataset(open_files, combine="by_coords", concat_dim="time", engine="h5netcdf").load()

use presence of auth kwargs as skip trigger in fixture test