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

Re-enable Windows builds #518

Merged
merged 5 commits into from
Jul 19, 2020
Merged

Re-enable Windows builds #518

merged 5 commits into from
Jul 19, 2020

Conversation

seisman
Copy link
Member

@seisman seisman commented Jul 12, 2020

Description of proposed changes

The test test_image() crashes on Windows. It's unclear to me why it fails, because it's a very simple test.

This PR skips the test on Windows, and enables Windows builds.

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
Copy link
Member

weiji14 commented Jul 14, 2020

@seisman, not sure if it's a coincidence, but I think this test_image.py is causing the failure at #476 (comment) Edit: false alarm, test_image runs after test_grdimage. I've been using pytest-randomly to run our tests in random order, and this is one of the failures:

$ make test
# Run a tmp folder to make sure the tests are run on the installed version
mkdir -p tmp-test-dir-with-unique-name

PyGMT information:
  version: v0.1.2+40.g5a685b2.dirty
System information:
  python: 3.7.6 | packaged by conda-forge | (default, Jun  1 2020, 18:57:50)  [GCC 7.5.0]
  executable: /home/user/miniconda3/envs/pygmt/bin/python
  machine: Linux-5.4.0-39-generic-x86_64-with-debian-bullseye-sid
Dependency information:
  numpy: 1.18.5
  pandas: 1.0.5
  xarray: 0.16.0
  netCDF4: 1.5.3
  packaging: 20.4
  ghostscript: 9.22
  gmt: 6.1.0
GMT library information:
  binary dir: /home/user/miniconda3/envs/pygmt/bin
  cores: 6
  grid layout: rows
  library path: /home/user/miniconda3/envs/pygmt/lib/libgmt.so
  padding: 2
  plugin dir: /home/user/miniconda3/envs/pygmt/lib/gmt/plugins
  share dir: /home/user/miniconda3/envs/pygmt/share/gmt
  version: 6.1.0

cd tmp-test-dir-with-unique-name; pytest --randomly-seed=3713667424 --fulltrace --exitfirst --cov=pygmt --cov-config=../.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html --doctest-modules -v --mpl --mpl-results-path=results --pyargs  pygmt
================================================================================= test session starts ==================================================================================
platform linux -- Python 3.7.6, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 -- /home/user/miniconda3/envs/pygmt/bin/python
cachedir: .pytest_cache
Using --randomly-seed=3713667424
Matplotlib: 3.2.2
Freetype: 2.10.2
rootdir: /home/user/pygmt, inifile: setup.cfg
plugins: xdist-1.33.0, flakefinder-0.1.3, rerunfailures-9.0, cov-2.10.0, randomly-3.4.1, forked-1.2.0, mpl-0.11
collected 275 items                                                                                                                                                                    

../pygmt/tests/test_which.py::test_which_fails PASSED                                                                                                                            [  0%]
../pygmt/tests/test_which.py::test_which PASSED                                                                                                                                  [  0%]
../pygmt/tests/test_surface.py::test_surface_input_data_array PASSED                                                                                                             [  1%]
../pygmt/tests/test_surface.py::test_surface_short_aliases PASSED                                                                                                                [  1%]
../pygmt/tests/test_surface.py::test_surface_input_xyz PASSED                                                                                                                    [  1%]
../pygmt/tests/test_surface.py::test_surface_input_xy_no_z PASSED                                                                                                                [  2%]
../pygmt/tests/test_surface.py::test_surface_wrong_kind_of_input PASSED                                                                                                          [  2%]
../pygmt/tests/test_surface.py::test_surface_input_file PASSED                                                                                                                   [  2%]
../pygmt/tests/test_surface.py::test_surface_with_outfile_param PASSED                                                                                                           [  3%]
../pygmt/tests/test_config.py::test_config_format_time_map PASSED                                                                                                                [  3%]
../pygmt/tests/test_config.py::test_config_map_tick_length PASSED                                                                                                                [  4%]
../pygmt/tests/test_config.py::test_config_map_grid_cross_size PASSED                                                                                                            [  4%]
../pygmt/tests/test_config.py::test_config_map_grid_pen PASSED                                                                                                                   [  4%]
../pygmt/tests/test_config.py::test_config_map_annot_offset PASSED                                                                                                               [  5%]
../pygmt/tests/test_config.py::test_config_font_annot XFAIL                                                                                                                      [  5%]
../pygmt/tests/test_config.py::test_config_font_one XFAIL                                                                                                                        [  5%]
../pygmt/tests/test_config.py::test_config_map_tick_pen PASSED                                                                                                                   [  6%]
../pygmt/tests/test_config.py::test_config XFAIL                                                                                                                                 [  6%]
../pygmt/tests/test_clib.py::test_extract_region_fails PASSED                                                                                                                    [  6%]
../pygmt/tests/test_clib.py::test_virtualfile_from_vectors PASSED                                                                                                                [  7%]
../pygmt/tests/test_clib.py::test_call_module_invalid_arguments PASSED                                                                                                           [  7%]
../pygmt/tests/test_clib.py::test_virtualfile_from_matrix PASSED                                                                                                                 [  8%]
../pygmt/tests/test_clib.py::test_parse_constant_single PASSED                                                                                                                   [  8%]
../pygmt/tests/test_clib.py::test_write_data_fails PASSED                                                                                                                        [  8%]
../pygmt/tests/test_clib.py::test_put_matrix_fails PASSED                                                                                                                        [  9%]
../pygmt/tests/test_clib.py::test_info_dict PASSED                                                                                                                               [  9%]
../pygmt/tests/test_clib.py::test_virtual_file PASSED                                                                                                                            [  9%]
../pygmt/tests/test_clib.py::test_destroy_session_fails PASSED                                                                                                                   [ 10%]
../pygmt/tests/test_clib.py::test_virtual_file_fails PASSED                                                                                                                      [ 10%]
../pygmt/tests/test_clib.py::test_create_session_fails PASSED                                                                                                                    [ 10%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_negative_x_and_y_increment PASSED                                                                                          [ 11%]
../pygmt/tests/test_clib.py::test_virtualfile_from_vectors_pandas PASSED                                                                                                         [ 11%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_inc_fails PASSED                                                                                                           [ 12%]
../pygmt/tests/test_clib.py::test_call_module PASSED                                                                                                                             [ 12%]
../pygmt/tests/test_clib.py::test_put_vector_2d_fails PASSED                                                                                                                     [ 12%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_dims_fails PASSED                                                                                                          [ 13%]
../pygmt/tests/test_clib.py::test_put_matrix_grid PASSED                                                                                                                         [ 13%]
../pygmt/tests/test_clib.py::test_fails_for_wrong_version PASSED                                                                                                                 [ 13%]
../pygmt/tests/test_clib.py::test_parse_constant_fails PASSED                                                                                                                    [ 14%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_negative_x_increment PASSED                                                                                                [ 14%]
../pygmt/tests/test_clib.py::test_put_vector PASSED                                                                                                                              [ 14%]
../pygmt/tests/test_clib.py::test_put_vector_invalid_dtype PASSED                                                                                                                [ 15%]
../pygmt/tests/test_clib.py::test_method_no_session PASSED                                                                                                                       [ 15%]
../pygmt/tests/test_clib.py::test_call_module_invalid_name PASSED                                                                                                                [ 16%]
../pygmt/tests/test_clib.py::test_extract_region_two_figures PASSED                                                                                                              [ 16%]
../pygmt/tests/test_clib.py::test_virtual_file_bad_direction PASSED                                                                                                              [ 16%]
../pygmt/tests/test_clib.py::test_parse_constant_composite PASSED                                                                                                                [ 17%]
../pygmt/tests/test_clib.py::test_virtualfile_from_vectors_arraylike PASSED                                                                                                      [ 17%]
../pygmt/tests/test_clib.py::test_put_vector_wrong_column PASSED                                                                                                                 [ 17%]
../pygmt/tests/test_clib.py::test_create_data_dataset PASSED                                                                                                                     [ 18%]
../pygmt/tests/test_clib.py::test_virtualfile_from_matrix_slice PASSED                                                                                                           [ 18%]
../pygmt/tests/test_clib.py::test_get_default_fails PASSED                                                                                                                       [ 18%]
../pygmt/tests/test_clib.py::test_create_destroy_session PASSED                                                                                                                  [ 19%]
../pygmt/tests/test_clib.py::test_create_data_grid_dim PASSED                                                                                                                    [ 19%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_negative_y_increment PASSED                                                                                                [ 20%]
../pygmt/tests/test_clib.py::test_create_data_grid_range PASSED                                                                                                                  [ 20%]
../pygmt/tests/test_clib.py::test_virtualfile_from_vectors_diff_size PASSED                                                                                                      [ 20%]
../pygmt/tests/test_clib.py::test_virtualfile_from_vectors_transpose PASSED                                                                                                      [ 21%]
../pygmt/tests/test_clib.py::test_get_default PASSED                                                                                                                             [ 21%]
../pygmt/tests/test_clib.py::test_getitem PASSED                                                                                                                                 [ 21%]
../pygmt/tests/test_clib.py::test_dataarray_to_matrix_works PASSED                                                                                                               [ 22%]
../pygmt/tests/test_clib.py::test_put_matrix PASSED                                                                                                                              [ 22%]
../pygmt/tests/test_clib.py::test_call_module_error_message PASSED                                                                                                               [ 22%]
../pygmt/tests/test_clib.py::test_create_data_fails PASSED                                                                                                                       [ 23%]
../pygmt/tests/test_blockmedian.py::test_blockmedian_wrong_kind_of_input_table_matrix PASSED                                                                                     [ 23%]
../pygmt/tests/test_blockmedian.py::test_blockmedian_without_outfile_setting PASSED                                                                                              [ 24%]
../pygmt/tests/test_blockmedian.py::test_blockmedian_wrong_kind_of_input_table_grid PASSED                                                                                       [ 24%]
../pygmt/tests/test_blockmedian.py::test_blockmedian_input_filename PASSED                                                                                                       [ 24%]
../pygmt/tests/test_blockmedian.py::test_blockmedian_input_dataframe PASSED                                                                                                      [ 25%]
../pygmt/tests/test_legend.py::test_legend_entries XFAIL                                                                                                                         [ 25%]
../pygmt/tests/test_legend.py::test_legend_position PASSED                                                                                                                       [ 25%]
../pygmt/tests/test_legend.py::test_legend_specfile PASSED                                                                                                                       [ 26%]
../pygmt/tests/test_legend.py::test_legend_fails PASSED                                                                                                                          [ 26%]
../pygmt/tests/test_legend.py::test_legend_default_position PASSED                                                                                                               [ 26%]
../pygmt/tests/test_text.py::test_text_position PASSED                                                                                                                           [ 27%]
../pygmt/tests/test_text.py::test_text_without_text_input PASSED                                                                                                                 [ 27%]
../pygmt/tests/test_text.py::test_text_nonexistent_filename PASSED                                                                                                               [ 28%]
../pygmt/tests/test_text.py::test_text_justify_parsed_from_textfile PASSED                                                                                                       [ 28%]
../pygmt/tests/test_text.py::test_text_input_multiple_filenames PASSED                                                                                                           [ 28%]
../pygmt/tests/test_text.py::test_text_justify_bottom_right_and_top_left PASSED                                                                                                  [ 29%]
../pygmt/tests/test_text.py::test_text_angle_font_justify_from_textfile PASSED                                                                                                   [ 29%]
../pygmt/tests/test_text.py::test_text_xy_with_position_fails PASSED                                                                                                             [ 29%]
../pygmt/tests/test_text.py::test_text_input_remote_filename PASSED                                                                                                              [ 30%]
../pygmt/tests/test_text.py::test_text_single_line_of_text PASSED                                                                                                                [ 30%]
../pygmt/tests/test_text.py::test_text_pen PASSED                                                                                                                                [ 30%]
../pygmt/tests/test_text.py::test_text_multiple_lines_of_text PASSED                                                                                                             [ 31%]
../pygmt/tests/test_text.py::test_text_font_bold PASSED                                                                                                                          [ 31%]
../pygmt/tests/test_text.py::test_text_angle_30 PASSED                                                                                                                           [ 32%]
../pygmt/tests/test_text.py::test_text_fill PASSED                                                                                                                               [ 32%]
../pygmt/tests/test_text.py::test_text_round_clearance PASSED                                                                                                                    [ 32%]
../pygmt/tests/test_text.py::test_text_input_single_filename PASSED                                                                                                              [ 33%]
../pygmt/tests/test_text.py::test_text_position_offset_with_line PASSED                                                                                                          [ 33%]
../pygmt/tests/test_image.py::test_image PASSED                                                                                                                                  [ 33%]
../pygmt/tests/test_makecpt.py::test_makecpt_output_to_cpt_file PASSED                                                                                                           [ 34%]
../pygmt/tests/test_makecpt.py::test_makecpt_truncated_at_zlow_only FAILED                                                                                                       [ 34%]

======================================================================================= FAILURES =======================================================================================
_________________________________________________________________________ test_makecpt_truncated_at_zlow_only __________________________________________________________________________
Error: Image dimensions did not match.
  Expected shape: (1800, 900)
    /home/user/pygmt/tmp-test-dir-with-unique-name/results/tmpv2cw82c_/baseline-test_makecpt_truncated_at_zlow_only.png
  Actual shape: (1865, 2216)
    /home/user/pygmt/tmp-test-dir-with-unique-name/results/tmpv2cw82c_/test_makecpt_truncated_at_zlow_only.png

----------- coverage: platform linux, python 3.7.6-final-0 -----------
Name                                                                          Stmts   Miss  Cover   Missing
-----------------------------------------------------------------------------------------------------------
/home/user/pygmt/pygmt/base_plotting.py             191     89    53%   57, 212-214, 279-290, 315, 319, 341-432, 456-527, 530-533, 537, 546, 550, 573-632, 644-772, 809, 841, 943, 951-952, 969, 971, 975-976, 993-996
/home/user/pygmt/pygmt/clib/__init__.py               1      0   100%
/home/user/pygmt/pygmt/clib/conversion.py            34     16    53%   5-10, 91, 105, 108-109, 159-160, 201-203, 238-240, 319
/home/user/pygmt/pygmt/clib/loading.py               46     14    70%   43-44, 46, 71-77, 105-108, 135-141
/home/user/pygmt/pygmt/clib/session.py              224    100    55%   36, 47-49, 62, 122, 135, 138, 145, 165-179, 192, 200-224, 237, 242, 283, 286, 315-324, 337-349, 355, 367, 376, 379, 413, 466, 506, 720, 724-730, 774, 780, 784-794, 834-845, 936-1073, 1136-1234, 1239-1309, 1316, 1367-1381
/home/user/pygmt/pygmt/datasets/__init__.py           2      0   100%
/home/user/pygmt/pygmt/datasets/earth_relief.py      37     13    65%   50, 110, 144-154
/home/user/pygmt/pygmt/datasets/tutorial.py          19     10    47%   27-38, 57-61, 104-106
/home/user/pygmt/pygmt/exceptions.py                  7      0   100%
/home/user/pygmt/pygmt/figure.py                     98     47    52%   10-11, 102-105, 172, 220, 223-227, 232, 236, 271-294, 320-328, 352-358, 365-366, 373-376
/home/user/pygmt/pygmt/filtering.py                  30      0   100%
/home/user/pygmt/pygmt/gridding.py                   32      0   100%
/home/user/pygmt/pygmt/gridops.py                    26     19    27%   90-119
/home/user/pygmt/pygmt/helpers/__init__.py            3      0   100%
/home/user/pygmt/pygmt/helpers/decorators.py         55     25    55%   55-129, 131, 140, 144, 181, 192-194, 200, 266, 290-294, 296-297, 308, 329-333
/home/user/pygmt/pygmt/helpers/tempfile.py           24      0   100%
/home/user/pygmt/pygmt/helpers/utils.py              43      9    79%   57, 59, 61, 191-200
/home/user/pygmt/pygmt/mathops.py                    15      1    93%   62
/home/user/pygmt/pygmt/modules.py                    77     16    79%   43-46, 91-98, 262-265, 280-283
/home/user/pygmt/pygmt/sampling.py                   36     29    19%   71-112
/home/user/pygmt/pygmt/session_management.py          9      2    78%   31-32
/home/user/pygmt/pygmt/sphinx_gallery.py             16     11    31%   6-7, 27-35
-----------------------------------------------------------------------------------------------------------
TOTAL                                                                          1025    401    61%
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml

=============================================================================== short test summary info ================================================================================
FAILED ../pygmt/tests/test_makecpt.py::test_makecpt_truncated_at_zlow_only
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================== 1 failed, 90 passed, 4 xfailed in 79.44s (0:01:19) ==================================================================

Note how test_image.py precedes the failure on test_makecpt_truncated_at_zlow_only. I'll investigate a bit more, but just wanted to point out that you're on the right track here!

@seisman
Copy link
Member Author

seisman commented Jul 14, 2020

In commit 8270cc7, I added a standalone Python script test_image_debug.py and ran it before make test. The debug message looks good and the script doesn't crash. It's very confusing.

FYI, the upstream GMT recently has ~10 new failures (GenericMappingTools/gmt#3642) with errors like "can't read image":

pslegend (gmtapi_import_image): Could not read from file [C:/Users/VssAdministrator/.gmt/cache/SOEST_block4.png]
[Session gmt.exe (0)]: Error returned from GMT API: GMT_IMAGE_READ_ERROR (22)
[Session gmt.exe (0)]: Error returned from GMT API: GMT_IMAGE_READ_ERROR (22)
pslegend [ERROR]: Unable to read image C:/Users/VssAdministrator/.gmt/cache/SOEST_block4.png, no pattern set
pslegend [ERROR]: Trouble reading SOEST_block4.png! - Skipping.

These GMT tests all pass when GMT made the 6.1.0 release. I don't think GMT made any changes recently. We also didn't update any packages on Windows CI. It's unclear why they suddenly fail.

@weiji14
Copy link
Member

weiji14 commented Jul 14, 2020

Yes it's confusing, especially how things work on one OS and not the other. Do you think it's something with the new GDAL version?

@seisman
Copy link
Member Author

seisman commented Jul 14, 2020

Do you think it's something with the new GDAL version?

conda-forge is providing the GDAL 3.1.1, which is known to cause crashes when reading geotiff files, but we don't read geotiff.

@weiji14
Copy link
Member

weiji14 commented Jul 15, 2020

Probably not GDAL then, since the CI is using GDAL 3.0.4 instead of 3.1.1. There's actually a line in the debug information that says:

image [INFORMATION]: Processing input raster via GDAL

but that's probably not relevant. I'll try and logon to my Windows session at uni now and see if I can debug this. Edit: My Windows conda environment got messed up real bad somehow, so no progress :/

@leouieda
Copy link
Member

Ah the joy of Windows builds 🙂

@weiji14 weiji14 added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog labels Jul 17, 2020
@weiji14
Copy link
Member

weiji14 commented Jul 17, 2020

Conda seems to be down (see https://twitter.com/ckinzthompson/status/1284240422953529354).

@@ -109,7 +108,9 @@ jobs:
# Run the tests
- name: Test with pytest
shell: bash -l {0}
run: make test PYTEST_EXTRA="-r P"
run: |
python pygmt/tests/test_image_debug.py
Copy link
Member

@weiji14 weiji14 Jul 17, 2020

Choose a reason for hiding this comment

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

Ok, CI seems to be working again. Could you please remove this debug script, and change the title to just say 'Re-enable Windows builds'?

Copy link
Member

Choose a reason for hiding this comment

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

Oops, spoke too soon. Windows build failing on test_grdimage_over_dateline!

Copy link
Member Author

Choose a reason for hiding this comment

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

How do you know it fails on test_grdimage_over_dateline?

Copy link
Member

Choose a reason for hiding this comment

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

The last build (before you force pushed) ran into a segfault I think. Now it just segfaults on test_image.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now it just segfaults on test_image.

That's why I added the test_image_debug.py script. It ran fine. Perhaps we should also let test_image "runfirst"?

Copy link
Member

Choose a reason for hiding this comment

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

Still doesn't work. We need to fix this upstream @seisman, all these workarounds are getting out of hand. I can help to finalize #485 so we can test GMT master, but tracking down the problem in the C code will be out of my area of expertise.

@seisman seisman changed the title Enable Windows builds and documentation Enable Windows builds Jul 17, 2020
@seisman seisman marked this pull request as ready for review July 18, 2020 05:48
@seisman seisman requested a review from weiji14 July 18, 2020 05:48
@seisman
Copy link
Member Author

seisman commented Jul 18, 2020

I skip the test test_image on Windows, and now the Windows builds are all good.

@seisman seisman changed the title Enable Windows builds Re-enable Windows builds Jul 18, 2020
@seisman seisman added this to the 0.2.x milestone Jul 19, 2020
@seisman seisman merged commit ef0099e into master Jul 19, 2020
@seisman seisman deleted the enable-windows branch July 19, 2020 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants