diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 0bd37628fa5..3f7049a1a5b 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -85,6 +85,8 @@ jobs: # Run the benchmark tests - name: Run benchmarks uses: CodSpeedHQ/action@9d332c4d90b43981c3e55ae8e38e68709996240f # v4.17.0 + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata with: mode: "instrumentation" # 'bash -el -c' is needed to use the custom shell. diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index 8f83f9f4559..a0c14d874bb 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -70,6 +70,8 @@ jobs: # Download remote files - name: Download remote data + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | python -c "from pygmt.helpers.caching import cache_data; cache_data()" diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index c769ff76408..62cf388cb7d 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -135,6 +135,8 @@ jobs: python -m pip install dist/* - name: Build the HTML documentation + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/sphinx-html.log" make -C doc clean html 2>&1 | tee "${log_file}" @@ -146,6 +148,8 @@ jobs: exit "${exit_code}" - name: Build the PDF documentation + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/sphinx-pdf.log" make -C doc pdf 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index c4a8d6cdbed..bda06d0491d 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -84,6 +84,8 @@ jobs: # Run the doctests - name: Run doctests + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/pytest.log" make doctest PYTEST_EXTRA="-r P" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 9d838bfdc91..117b1229837 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -189,6 +189,8 @@ jobs: # Run the regular tests - name: Run tests + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/pytest.log" make test PYTEST_EXTRA="-r P --reruns 2" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index f185b087a27..01745d921f5 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -184,6 +184,7 @@ jobs: - name: Test with pytest run: make test PYTEST_EXTRA="-r P --reruns 2" env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib # Upload diff images on test failure diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index ea73fe1bef1..dabad490531 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -95,4 +95,6 @@ jobs: # Run the tests but skip images - name: Run tests + env: + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: make test_no_images PYTEST_EXTRA="-r P" diff --git a/examples/tutorials/advanced/draping_on_3d_surface.py b/examples/tutorials/advanced/draping_on_3d_surface.py index 4479df5a06d..db5228f94ca 100644 --- a/examples/tutorials/advanced/draping_on_3d_surface.py +++ b/examples/tutorials/advanced/draping_on_3d_surface.py @@ -99,7 +99,9 @@ # The original image is available on Wikimedia Commons at # https://commons.wikimedia.org/wiki/File:Flag_of_Europe.svg # but we use a cached version on the GMT data server. -url_to_image = "https://oceania.generic-mapping-tools.org/cache/euflag.png" +url_to_image = ( + "https://github.com/GenericMappingTools/gmtserver-admin/raw/master/cache/euflag.png" +) with rasterio.open(url_to_image) as dataset: data = dataset.read() drape_grid = xr.DataArray(data, dims=("band", "y", "x")) diff --git a/pygmt/tests/test_datatypes_dataset.py b/pygmt/tests/test_datatypes_dataset.py index f170e22d7bf..1e6ab838d9c 100644 --- a/pygmt/tests/test_datatypes_dataset.py +++ b/pygmt/tests/test_datatypes_dataset.py @@ -156,25 +156,17 @@ def test_dataset_to_strings_with_none_values(): See the bug report at https://github.com/GenericMappingTools/pygmt/issues/3170. """ - # Sometimes, the test may fail in CI due to intermittent internet connection issue. - # Catch the FileNotFoundError exception so that we can focus on the bug. tiles = ["@N30E060.earth_age_01m_g.nc", "@N30E090.earth_age_01m_g.nc"] - try: - paths = which(fname=tiles, download="auto") - assert len(paths) == 2 - # 'paths' may contain an empty string or not, depending on if tiles are cached. - if "" not in paths: # Contains two valid paths. - # Delete the cached tiles and try again. - for path in paths: - Path(path).unlink() - with pytest.warns(expected_warning=RuntimeWarning) as record: # noqa: PT031 - try: - paths = which(fname=tiles, download="auto") - assert len(record) == 1 - assert len(paths) == 2 - assert "" in paths - except FileNotFoundError: - pass - except FileNotFoundError: - pass + paths = which(fname=tiles, download="auto") + assert len(paths) == 2 + # 'paths' may contain an empty string or not, depending on if the tiles are cached. + if "" not in paths: # Contains two valid paths. + # Delete the cached tiles and try again. + for path in paths: + Path(path).unlink() + with pytest.warns(expected_warning=RuntimeWarning) as record: + paths = which(fname=tiles, download="auto") + assert len(record) == 1 + assert len(paths) == 2 + assert "" in paths diff --git a/pygmt/tests/test_which.py b/pygmt/tests/test_which.py index 40f6eb31ccc..fd07b32b94b 100644 --- a/pygmt/tests/test_which.py +++ b/pygmt/tests/test_which.py @@ -68,10 +68,7 @@ def test_which_nonascii_path(monkeypatch): # Start a new session begin() # GMT should download the remote file under the new home directory. - try: - fname = which(fname="@static_earth_relief.nc", download="cache") - except FileNotFoundError: - pytest.skip("Failed to download the file, skipping the test.") + fname = which(fname="@static_earth_relief.nc", download="cache") assert fname.startswith(fakehome) assert fname.endswith("static_earth_relief.nc") end()