Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache test data on Azure Pipelines #438

Merged
merged 6 commits into from
May 20, 2020
Merged

Cache test data on Azure Pipelines #438

merged 6 commits into from
May 20, 2020

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented May 20, 2020

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.

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.
.azure-pipelines.yml Outdated Show resolved Hide resolved
@weiji14
Copy link
Member Author

weiji14 commented May 20, 2020

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 is None, reason="requires sphinx-gallery")
     def test_pygmtscraper():
         "Make sure the scraper finds the figures and removes them from the pool."
     
         showed = [fig for fig in SHOWED_FIGURES]
         for _ in range(len(SHOWED_FIGURES)):
             SHOWED_FIGURES.pop()
         try:
             fig = Figure()
             fig.coast(region="BR", projection="M6i", land="gray", frame=True)
             fig.show()
             assert len(SHOWED_FIGURES) == 1
             assert SHOWED_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])}
                 assert not 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'
 
     def relpath(path, start=None):
         """Return a relative version of a path"""
         path = os.fspath(path)
         if isinstance(path, bytes):
             sep = b'\\'
             curdir = b'.'
             pardir = b'..'
         else:
             sep = '\\'
             curdir = '.'
             pardir = '..'
     
         if start is None:
             start = curdir
     
         if not path:
             raise ValueError("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 -----------

Sign up for free to 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