Skip to content

Cache test data on Azure Pipelines - #438

Merged
weiji14 merged 6 commits into
masterfrom
azure-cache-data
May 20, 2020
Merged

Cache test data on Azure Pipelines#438
weiji14 merged 6 commits into
masterfrom
azure-cache-data

Conversation

@weiji14

Copy link
Copy Markdown
Member

Description of proposed changes

Windows builds on Azure Pipelines can't seem to fetch GMT data from http://oceania.generic-mapping-tools.org/, as mentioned in #434 (comment). This Pull Request mimics the upstream GMT one at GenericMappingTools/gmt#3056.

Files we are caching includes:

  • @earth_relief_10m
  • @earth_relief_60m
  • @ridge.txt
  • @Table_5_11.txt
  • @tut_quakes.ngdc
  • @tut_ship.xyz.

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

weiji14 added 2 commits May 20, 2020 20:32
Includes @earth_relief_10m, @earth_relief_60m, @ridge.txt, @Table_5_11.txt , @tut_quakes.ngdc, and @tut_ship.xyz.
So that `gmt` command can be found.
Comment thread.azure-pipelines.yml Outdated
@weiji14

Copy link
Copy Markdown
MemberAuthor

Thanks for spotting the $HOMEPATH fix! We're now down to the 3 errors below. Will resolve them in separate Pull Requests to make things easier to review. Merging this in now.

================================== FAILURES ===================================
__________________ [doctest] pygmt.clib.conversion._as_array __________________
221 222 Examples
223 --------
224 225 >>> import pandas as pd
226 >>> x_series = pd.Series(data=[1, 2, 3, 4])
227 >>> x_array = _as_array(x_series)
228 >>> type(x_array)
229 <class 'numpy.ndarray'>
230 >>> x_array
Expected:
array([1, 2, 3, 4])
Got:
array([1, 2, 3, 4], dtype=int64)
C:\Miniconda\envs\testing\Lib\site-packages\pygmt\clib\conversion.py:230: DocTestFailure
___________ [doctest] pygmt.clib.conversion.kwargs_to_ctypes_array ____________
263 Returns
264 -------
265 ctypes_value : ctypes array or None
266 267 Examples
268 --------
269 270 >>> import ctypes as ct
271 >>> value = kwargs_to_ctypes_array('bla', {'bla': [10, 10]}, ct.c_int*2)
272 >>> type(value)
Expected:
<class'pygmt.clib.conversion.c_int_Array_2'>
Got:
<class'pygmt.clib.conversion.c_long_Array_2'>
C:\Miniconda\envs\testing\Lib\site-packages\pygmt\clib\conversion.py:272: DocTestFailure
______________________________ test_pygmtscraper ______________________________
@pytest.mark.skipif(sphinx_gallery isNone, reason="requires sphinx-gallery")
deftest_pygmtscraper():
"Make sure the scraper finds the figures and removes them from the pool."
showed = [fig for fig inSHOWED_FIGURES]
for _ inrange(len(SHOWED_FIGURES)):
SHOWED_FIGURES.pop()
try:
fig = Figure()
fig.coast(region="BR", projection="M6i", land="gray", frame=True)
fig.show()
assertlen(SHOWED_FIGURES) ==1assertSHOWED_FIGURES[0] is fig
scraper = PyGMTScraper()
with TemporaryDirectory() as tmpdir:
conf = {"src_dir": "meh"}
fname = os.path.join(tmpdir, "meh.png")
block_vars = {"image_path_iterator": (i for i in [fname])}
assertnot os.path.exists(fname)
> scraper(None, block_vars, conf)
C:\Miniconda\envs\testing\Lib\site-packages\pygmt\tests\test_sphinx_gallery.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Miniconda\envs\testing\Lib\site-packages\pygmt\sphinx_gallery.py:35: in __call__
return figure_rst(image_names, gallery_conf["src_dir"])
C:\Miniconda\envs\testing\Lib\site-packages\sphinx_gallery\scrapers.py:264: in figure_rst
figure_paths = [os.path.relpath(figure_path, sources_dir)
C:\Miniconda\envs\testing\Lib\site-packages\sphinx_gallery\scrapers.py:264: in <listcomp>
figure_paths = [os.path.relpath(figure_path, sources_dir)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = 'C:\\Users\\VSSADM~1\\AppData\\Local\\Temp\\tmpl_p8uqy7\\meh.png'
start = 'meh'
defrelpath(path, start=None):
"""Return a relative version of a path"""
path = os.fspath(path)
ifisinstance(path, bytes):
sep =b'\\'
curdir =b'.'
pardir =b'..'else:
sep ='\\'
curdir ='.'
pardir ='..'if start isNone:
start = curdir
ifnot path:
raiseValueError("no path specified")
start = os.fspath(start)
try:
start_abs = abspath(normpath(start))
path_abs = abspath(normpath(path))
start_drive, start_rest = splitdrive(start_abs)
path_drive, path_rest = splitdrive(path_abs)
if normcase(start_drive) != normcase(path_drive):
> raise ValueError("path is on mount %r, start on mount %r" % (
path_drive, start_drive))
E ValueError: path is on mount 'C:', start on mount 'D:'
C:\Miniconda\envs\testing\lib\ntpath.py:703: ValueError
---------------------------- Captured stderr call -----------------------------
psconvert [ERROR]: Error opening HKLM key
psconvert [ERROR]: Error opening HKLM key
============================== warnings summary ===============================
C:\Miniconda\envs\testing\lib\site-packages\win32\lib\pywintypes.py:2
C:\Miniconda\envs\testing\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp, sys, os
-- Docs: https://docs.pytest.org/en/latest/warnings.html
----------- coverage: platform win32, python 3.8.2-final-0 -----------

@weiji14
weiji14 merged commit 6d4c695 into masterMay 20, 2020
@weiji14
weiji14 deleted the azure-cache-data branch May 20, 2020 22:00
@seismanseisman added this to the 0.1.x milestone May 22, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@weiji14@seisman