Closed geekdenz closed 4 years ago
Thanks for contributing @geekdenz ! Looks like installing GDAL python bindings failed. For running all unit tests you will need all Provider components, including native, like GDAL/OGR , ES, PG...That is not yet well documented. A good starting point is the Travis file which is basically the sequence of (Linux Deb Ubuntu) actions to get all tests running, see https://github.com/geopython/pygeoapi/blob/master/.travis.yml Can you give that a try first and we'll work from there?
Thanks @justb4 ! Now I'm just letting Travis do the work for this.
I would like to run unit tests so that I can contribute my enhancements and bug fixes.
When I run:
pytest tests
I get ` ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.7.3, pytest-5.3.0, py-1.8.0, pluggy-0.13.1 rootdir: /home/heuert/projects/landcare/pygeoapi/pygeoapi, inifile: pytest.ini plugins: cov-2.8.1, env-0.6.2 collected 34 items / 4 errors / 30 selected========================================================================================== ERRORS =========================================================================================== _ ERROR collecting tests/test_ogr_gpkg_provider.py __ ImportError while importing test module '/home/heuert/projects/landcare/pygeoapi/pygeoapi/tests/test_ogr_gpkg_provider.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_ogr_gpkg_provider.py:36: in
from pygeoapi.provider.ogr import OGRProvider
pygeoapi/provider/ogr.py:33: in
from osgeo import gdal as osgeo_gdal
E ModuleNotFoundError: No module named 'osgeo'
_ ERROR collecting tests/test_ogr_shapefile_provider.py _____
ImportError while importing test module '/home/heuert/projects/landcare/pygeoapi/pygeoapi/tests/test_ogr_shapefile_provider.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_ogr_shapefile_provider.py:36: in
from pygeoapi.provider.ogr import OGRProvider
pygeoapi/provider/ogr.py:33: in
from osgeo import gdal as osgeo_gdal
E ModuleNotFoundError: No module named 'osgeo'
ERROR collecting tests/test_ogr_sqliteprovider.py ____
ImportError while importing test module '/home/heuert/projects/landcare/pygeoapi/pygeoapi/tests/test_ogr_sqlite_provider.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_ogr_sqlite_provider.py:36: in
from pygeoapi.provider.ogr import OGRProvider
pygeoapi/provider/ogr.py:33: in
from osgeo import gdal as osgeo_gdal
E ModuleNotFoundError: No module named 'osgeo'
__ ERROR collecting tests/test_ogr_wfs_provider.py __
ImportError while importing test module '/home/heuert/projects/landcare/pygeoapi/pygeoapi/tests/test_ogr_wfs_provider.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_ogr_wfs_provider.py:35: in
from pygeoapi.provider.ogr import OGRProvider
pygeoapi/provider/ogr.py:33: in
from osgeo import gdal as osgeo_gdal
E ModuleNotFoundError: No module named 'osgeo'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 4 errors in 0.26s =====================================================================================
`
I then run
pip install -r requirements-provider.txt
with ` Requirement already satisfied: elasticsearch==7.0.4 in /home/heuert/miniconda3/lib/python3.7/site-packages (from -r requirements-provider.txt (line 1)) (7.0.4) Collecting GDAL<3.0,>=2.2 (from -r requirements-provider.txt (line 2)) Using cached https://files.pythonhosted.org/packages/40/36/1a170d95275eb25316a0c12b24e2a2d6ebb1c8cdfa7e9eaf0a7c901822ad/GDAL-2.4.3.tar.gz ERROR: Complete output from command python setup.py egg_info: ERROR: running egg_info creating pip-egg-info/GDAL.egg-infowriting pip-egg-info/GDAL.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/GDAL.egg-info/toplevel.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/tmp/pip-install-ozhmbs2/GDAL/setup.py", line 151, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/home/heuert/miniconda3/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/home/heuert/miniconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
ERROR: Command "python setup.py egginfo" failed with error code 1 in /tmp/pip-install-ozhmbs2/GDAL/ ` as output, which I believe is a dependency for running unit tests.
Expected behavior Tests run somewhat successfully.
Environment
Additional context Trying to help develop PyGeoAPI