bird-house / flyingpigeon

WPS processes for climate model data, indices and extreme events
http://flyingpigeon.readthedocs.io/en/latest/
Apache License 2.0
19 stars 15 forks source link

Tests for subset countries continents (clipping function) #282

Closed nilshempelmann closed 4 years ago

nilshempelmann commented 5 years ago

Processes are running fine, but test are failing

nilshempelmann commented 4 years ago

error message:

Traceback (most recent call last):
  File "/home/nils/anaconda3/envs/flyingpigeon/lib/python3.7/site-packages/pywps/app/Process.py", line 22
    self.handler(wps_request, wps_response)  # the user must update the wps_response.
  File "/home/nils/birdhouse/flyingpigeon/flyingpigeon/processes/wps_subset_continents.py", line 107, in 
    raise Exception(msg)
Exception: Clipping failed: expected str, bytes or os.PathLike object, not NoneType
nilshempelmann commented 4 years ago

@huard Are the test really running locally on your side?

huard commented 4 years ago

@nilshempelmann Yes

(flyingpigeon) david@DavidH-linux:~/src/flyingpigeon$ pytest tests/test_wps_subset_continents.py 
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.0
rootdir: /home/david/src/flyingpigeon, inifile: setup.cfg
plugins: flake8-1.0.4, nbval-0.9.5
collected 1 item                                                                                                                                                                                           

tests/test_wps_subset_continents.py .                                                                                                                                                                [100%]

============================================================================================= warnings summary =============================================================================================
/home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/__init__.py:8
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/__init__.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

/home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/gdal.py:107
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/gdal.py:107: DeprecationWarning: ogr.py was placed in a namespace, it is now available as osgeo.ogr
    DeprecationWarning)

tests/test_wps_subset_continents.py::test_wps_subset_continents
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
    return f(*args, **kwds)

tests/test_wps_subset_continents.py::test_wps_subset_continents
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/ocgis-2.1.1-py3.7.egg/ocgis/spatial/wrap.py:69: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
    ret[select] -= np.asscalar(np.array(360.).astype(ret.dtype))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
====================================================================================== 1 passed, 4 warnings in 2.50s =======================================================================================
(flyingpigeon) david@DavidH-linux:~/src/flyingpigeon$ pytest tests/test_wps_subset_countries.py 
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.0
rootdir: /home/david/src/flyingpigeon, inifile: setup.cfg
plugins: flake8-1.0.4, nbval-0.9.5
collected 1 item                                                                                                                                                                                           

tests/test_wps_subset_countries.py .                                                                                                                                                                 [100%]

============================================================================================= warnings summary =============================================================================================
/home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/__init__.py:8
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/__init__.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

/home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/gdal.py:107
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/osgeo/gdal.py:107: DeprecationWarning: ogr.py was placed in a namespace, it is now available as osgeo.ogr
    DeprecationWarning)

tests/test_wps_subset_countries.py::test_wps_subset_countries
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
    return f(*args, **kwds)

tests/test_wps_subset_countries.py::test_wps_subset_countries
  /home/david/.conda/envs/flyingpigeon/lib/python3.7/site-packages/ocgis-2.1.1-py3.7.egg/ocgis/spatial/wrap.py:69: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
    ret[select] -= np.asscalar(np.array(360.).astype(ret.dtype))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
====================================================================================== 1 passed, 4 warnings in 1.78s =======================================================================================
huard commented 4 years ago

Weird, when I run them within the entire test suite, they fail, when I run them individually, they pass...

huard commented 4 years ago

The issue seems to be triggered by test_wps_spatial_analog. I think the setUp and tearDown methods are the culprit.

nilshempelmann commented 4 years ago

@huard I see. good to have the problem identified.