Skip to content

Finalize fixes on WIndows test suite for v0.1.1 - #441

Merged
weiji14 merged 5 commits into
masterfrom
fix-win-tests
May 21, 2020
Merged

Finalize fixes on WIndows test suite for v0.1.1#441
weiji14 merged 5 commits into
masterfrom
fix-win-tests

Conversation

@weiji14

@weiji14weiji14 commented May 20, 2020

Copy link
Copy Markdown
Member

Description of proposed changes

Towards a fully working Windows test suite! Several of our unit tests (~8) have been failing since #434, and we've addressed them in several PRs already. This one will hopefully squash the last of them.

Merge after these are completed (in order):

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.

Exact error message was "ValueError: path is on mount 'C:', start on mount 'D:'."
@weiji14weiji14 added this to the 0.1.x milestone May 20, 2020
@weiji14

Copy link
Copy Markdown
MemberAuthor

Last 2 tests to fix! Investigating now, might be related to how numpy on Windows handles integers compared to Linux/MacOS. (see e.g. numpy/numpy#10317?)

================================== 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

@seisman

Copy link
Copy Markdown
Member

Perhaps change the tests a little bit. For example, changing

>>> x_array

to

>>> x_array.dtype
>>> list(x_array)

Comment threadpygmt/clib/conversion.py Outdated
Because running np.asarray on a pandas.Series returns a numpy.ndarray anyway.
Comment on lines -271 to +231
>>> value = kwargs_to_ctypes_array('bla', {'bla': [10, 10]}, ct.c_int*2)
>>> value = kwargs_to_ctypes_array('bla', {'bla': [10, 10]}, ct.c_long*2)
>>> type(value)
<class 'pygmt.clib.conversion.c_int_Array_2'>
<class 'pygmt.clib.conversion.c_long_Array_2'>

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c_int is just an alias for c_long according to https://docs.python.org/3/library/ctypes.html#ctypes-tutorial. Changing it to c_long should make this test pass in a cross-platform way.

@weiji14
weiji14 marked this pull request as ready for review May 21, 2020 02:49
@weiji14

Copy link
Copy Markdown
MemberAuthor

Awesome, all green and good to go!

@weiji14
weiji14 merged commit 66afff5 into masterMay 21, 2020
@weiji14
weiji14 deleted the fix-win-tests branch May 21, 2020 03:14
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