Skip to content

Commit

Permalink
Merge branch 'main' into optional-deps-env
Browse files Browse the repository at this point in the history
  • Loading branch information
leouieda authored Jun 4, 2024
2 parents 5dd7a05 + 030f928 commit 6121018
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:
test:
name: ${{ matrix.os }} python=${{ matrix.python }} dependencies=${{ matrix.dependencies }}
if: ${{ github.repository_owner == 'fatiando' || github.event_name != 'schedule' }}
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
# Otherwise, the workflow would stop if a single job fails. We want to
# run all of them to catch failures in different combinations.
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
- ubuntu-latest
- macos-latest
- windows-latest
dependencies:
- oldest
- latest
Expand All @@ -50,6 +50,14 @@ jobs:
python: "3.11"
- dependencies: optional
python: "3.11"
# test on macos-13 (x86) using oldest dependencies and python 3.7
- os: macos-13
dependencies: oldest
python: "3.7"
exclude:
# don't test on macos-latest (arm64) with oldest dependencies
- os: macos-latest
dependencies: oldest
env:
REQUIREMENTS: env/requirements-build.txt env/requirements-test.txt
# Used to tag codecov submissions
Expand Down
9 changes: 4 additions & 5 deletions pooch/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,9 @@ def downloader(url, output, pooch): # pylint: disable=unused-argument
return None

pup = Pooch(path=DATA_DIR, base_url=BASEURL, registry=REGISTRY)
# First check that everything works without the custom downloader
assert pup.is_available("tiny-data.txt")
# Now use the bad one
with pytest.raises(NotImplementedError) as error:
msg = "does not support availability checks."
with pytest.raises(NotImplementedError, match=msg):
pup.is_available("tiny-data.txt", downloader=downloader)
assert "does not support availability checks" in str(error)


@pytest.mark.network
Expand Down Expand Up @@ -627,6 +624,7 @@ def test_stream_download(fname):
check_tiny_data(str(destination))


@pytest.mark.network
@pytest.mark.parametrize(
"url",
[FIGSHAREURL, ZENODOURL, DATAVERSEURL],
Expand All @@ -649,6 +647,7 @@ def test_load_registry_from_doi(url):
pup.fetch(filename)


@pytest.mark.network
def test_load_registry_from_doi_zenodo_with_slash():
"""
Check that the registry is correctly populated from the Zenodo API when
Expand Down
4 changes: 4 additions & 0 deletions pooch/tests/test_downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_unsupported_protocol():
choose_downloader("doii:XXX/XXX/file")


@pytest.mark.network
def test_invalid_doi_repository():
"Should fail if data repository is not supported"
with pytest.raises(ValueError) as exc:
Expand All @@ -96,13 +97,15 @@ def test_invalid_doi_repository():
assert "Invalid data repository 'joss.theoj.org'" in str(exc.value)


@pytest.mark.network
def test_doi_url_not_found():
"Should fail if the DOI is not found"
with pytest.raises(ValueError) as exc:
doi_to_url(doi="NOTAREALDOI")
assert "Is the DOI correct?" in str(exc.value)


@pytest.mark.network
@pytest.mark.parametrize(
"repository,doi",
[
Expand All @@ -121,6 +124,7 @@ def test_figshare_url_file_not_found(repository, doi):
assert "File 'bla.txt' not found" in str(exc.value)


@pytest.mark.network
@pytest.mark.parametrize(
"url",
[FIGSHAREURL, ZENODOURL, DATAVERSEURL],
Expand Down

0 comments on commit 6121018

Please sign in to comment.