Python pytest discovery fails when GDAL is being used; can't find GDAL_DATA
See original GitHub issueEnvironment data
- VS Code version: 1.47.2
- Extension version (available under the Extensions sidebar): v2020.7.96456
- OS and version: Debian 10
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): pyenv
- Relevant/affected Python packages and their versions: XXX
- Relevant/affected Python-related VS Code extensions and their versions: python test discovery
- Value of the
python.languageServer
setting: Microsoft
Expected behavior
Test Discovery succeeds
Actual behavior
Test discovery error, please check the configuration settings for the tests.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- create a venv with gdal installed
- write a test
- try and discover tests
- see error with
Test discovery failed
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
Output for Python Test Log
in the exthost1/output_logging_xxx/9-Python Test Log.log
python /home/hansenki/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /home/hansenki/workspace/plot-generator -s --cache-clear
Test Discovery failed:
Error: ERROR 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
Output for env | grep GDAL
and ls
output of the share dir, and pytest --collect-only
in the vscode terminal
env | grep GDAL
GDAL_DATA=/usr/share/gdal/
ls /usr/share/gdal/
bag_template.xml gcs.csv gt_datum.csv jpfgdgml_Cntr.gfs jpfgdgml_RdMgtBdry.gfs nitf_spec.xsd projop_wparm.csv trailer.dxf
compdcs.csv gcs.override.csv gt_ellips.csv jpfgdgml_CommBdry.gfs jpfgdgml_RdSgmtA.gfs ogrvrt.xsd ruian_vf_ob_v1.gfs unit_of_measure.csv
coordinate_axis.csv gdal_datum.csv header.dxf jpfgdgml_CommPt.gfs jpfgdgml_RvrMgtBdry.gfs osmconf.ini ruian_vf_st_uvoh_v1.gfs vdv452.xml
datum_shift.csv gdalicon.png inspire_cp_BasicPropertyUnit.gfs jpfgdgml_Cstline.gfs jpfgdgml_SBAPt.gfs ozi_datum.csv ruian_vf_st_v1.gfs vdv452.xsd
default.rsc GDALLogoBW.svg inspire_cp_CadastralBoundary.gfs jpfgdgml_ElevPt.gfs jpfgdgml_SBArea.gfs ozi_ellips.csv ruian_vf_v1.gfs vertcs.csv
eedaconf.json GDALLogoColor.svg inspire_cp_CadastralParcel.gfs jpfgdgml_GCP.gfs jpfgdgml_SBBdry.gfs pci_datum.txt s57agencies.csv vertcs.override.csv
ellipsoid.csv GDALLogoGS.svg inspire_cp_CadastralZoning.gfs jpfgdgml_LeveeEdge.gfs jpfgdgml_WA.gfs pci_ellips.txt s57attributes.csv
epsg.wkt gdalvrt.xsd jpfgdgml_AdmArea.gfs jpfgdgml_RailCL.gfs jpfgdgml_WL.gfs pcs.csv s57expectedinput.csv
esri_epsg.wkt geoccs.csv jpfgdgml_AdmBdry.gfs jpfgdgml_RdArea.gfs jpfgdgml_WStrA.gfs pcs.override.csv s57objectclasses.csv
esri_extra.wkt gmlasconf.xml jpfgdgml_AdmPt.gfs jpfgdgml_RdASL.gfs jpfgdgml_WStrL.gfs pds4_template.xml seed_2d.dgn
esri_StatePlane_extra.wkt gmlasconf.xsd jpfgdgml_BldA.gfs jpfgdgml_RdCompt.gfs netcdf_config.xsd plscenesconf.json seed_3d.dgn
esri_Wisconsin_extra.wkt gml_registry.xml jpfgdgml_BldL.gfs jpfgdgml_RdEdg.gfs nitf_spec.xml prime_meridian.csv stateplane.csv
================================================================================================== test session starts ==================================================================================================
platform linux -- Python 3.7.3, pytest-5.4.3, py-1.8.0, pluggy-0.12.0
rootdir: /home/hansenki/workspace/plot-generator, inifile: setup.cfg
plugins: forked-1.0.2, xdist-1.28.0, cov-2.7.1
collected 11 items
<Module test/unit/test_io.py>
<Function test_get_implement_details>
<Function test_get_planter_width>
<Module test/unit/test_make_dataset.py>
<Function test_correct_trimble_trip_points>
<Function test_generate_plots>
<Function test_generate_plots_with_prism_attributes>
<Module test/unit/test_util.py>
<Function test_chunker[1-expected_len0]>
<Function test_chunker[2-expected_len1]>
<Function test_chunker[3-expected_len2]>
<Function test_chunker[4-expected_len3]>
<Function test_chunker[5-expected_len4]>
<Function test_window[input0-2-expected0]>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
VSCode pytest test discovery fails - python
In my case the problem with vscode being unable to discover tests was the coverage module being enabled in the setup.cfg (alternatively this ......
Read more >Fiona 2.0dev documentation
The unsuccessful attempt to make GDAL and PROJ support file discovery and configuration automatic within collection's crs and crs_wkt properties has been ......
Read more >rasterio
Rasterio reads and writes these formats and provides a Python API based on N-D arrays. Rasterio 1.3 works with Python 3.8+, Numpy 1.18+,...
Read more >Raw file - Earthdata Source Code Repository
ZStd-compressed TIFF files produced by GDAL 2.3.0 will not be readable ... ENVI and ISCE that failed due to inappropriate check on file...
Read more >GDAL/OGR user docs
A list of EPSG coordinate systems can be found in the GDAL data files gcs.csv and pcs.csv. PROJ.4 Definitions: A PROJ.4 definition string...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@karrtikr Note that GDAL is one of those conda packages that rely on per-package activation scripts, and it specifically does that to set
GDAL_DATA
(among other things).Closing as no further info was provided.