Discussion:
[gdal-dev] Tons of errors in tests
Javier Jimenez Shaw
2021-06-02 14:26:52 UTC
Permalink
Hello

I am trying to build GDAL (this worked) and run the tests (tons of
failures). Because it is over a clean clone of master, I think there is
something wrong in my configuration. Maybe you can help me.

OS: Ubuntu 20.04
Python: 3.8.5
$ apt list --installed | grep gdal
gdal-bin/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
gdal-data/focal,focal,now 3.0.4+dfsg-1build3 all [installed,automatic]
libgdal-dev/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
libgdal26/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]
python3-gdal/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]

Following the instructions in
https://github.com/OSGeo/gdal/blob/master/CONTRIBUTING.md

cd gdal
./configure
make -j8 -s
cd apps; make -s test_ogrsf; cd ..

. scripts/setdevenv.sh
gdalinfo --version
$ GDAL 3.4.0dev-6b8835c2b5, released 2021/06/02

cd ../autotest
pip install -r requirements.txt

python -m pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
rootdir: /home/jshaw/work/gdal/autotest, inifile: pytest.ini, testpaths:
ogr, gcore, gdrivers, osr, alg, gnm, utilities, pyscripts
plugins: sugar-0.9.4, env-0.6.2
collecting ...
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting gcore/multidim.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
gcore/multidim.py:106: in <module>
???
E AttributeError: module 'osgeo.gdal' has no attribute 'GRIORA_RMS'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting alg/fillnodata.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:234: in
pytest_pycollect_makeitem
res = list(collector._genfunctions(name, obj))
/usr/lib/python3/dist-packages/_pytest/python.py:410: in _genfunctions
self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:137: in
pytest_generate_tests
metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/lib/python3/dist-packages/_pytest/python.py:1015: in parametrize
ids = self._resolve_arg_ids(argnames, ids, parameters,
item=self.definition)
/usr/lib/python3/dist-packages/_pytest/python.py:1069: in _resolve_arg_ids
ids = idmaker(argnames, parameters, idfn, ids, self.config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1221: in idmaker
ids = [
/usr/lib/python3/dist-packages/_pytest/python.py:1222: in <listcomp>
_idvalset(valindex, parameterset, argnames, idfn, ids, config=config,
item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1210: in _idvalset
if ids is None or (idx >= len(ids) or ids[idx] is None):
E TypeError: 'dict_keys' object is not subscriptable

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/test_gdal_utils.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/test_gdal_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/test_gdal_utils.py:37: in <module>
from osgeo_utils.auxiliary.extent_util import Extent
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/test_pct.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/test_pct.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/test_pct.py:37: in <module>
from osgeo_utils import gdalattachpct, rgb2pct
E ModuleNotFoundError: No module named 'osgeo_utils'

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py:36: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py:36: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_nb_data_bands.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_nb_data_bands.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_nb_data_bands.py:35: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_option_parser.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_option_parser.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_option_parser.py:37: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting pyscripts/gdal2tiles/test_reproject_dataset.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_reproject_dataset.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_reproject_dataset.py:36: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_setup_input_srs.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_setup_input_srs.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_setup_input_srs.py:34: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting pyscripts/gdal2tiles/test_setup_no_data_value.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_setup_no_data_value.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_setup_no_data_value.py:34: in <module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR collecting
pyscripts/gdal2tiles/test_update_alpha_value_for_non_alpha_inputs.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_update_alpha_value_for_non_alpha_inputs.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pyscripts/gdal2tiles/test_update_alpha_value_for_non_alpha_inputs.py:34: in
<module>
from osgeo_utils import gdal2tiles
E ModuleNotFoundError: No module named 'osgeo_utils'

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Interrupted: 12 errors during collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Results (5.85s):


If I run a particular file, I get also a many errors (ommited here), and a
core dump:

python -m pytest gcore/tiff_read.py
....
gcore/tiff_read.py ⚯✓s 97% █████████▊
Segmentation fault (core dumped)

Is there anything basically wrong? Am I using the wrong gdal, not the one
just compiled?

Thanks
.___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
Andrew C Aitchison
2021-06-02 15:35:31 UTC
Permalink
Post by Javier Jimenez Shaw
Hello
I am trying to build GDAL (this worked) and run the tests (tons of
failures). Because it is over a clean clone of master, I think there is
something wrong in my configuration. Maybe you can help me.
cd ../autotest
pip install -r requirements.txt
python -m pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
I have Ubuntu 21.04/hirsute:
(platform: linux, Python 3.9.5, pytest 6.2.3, pytest-sugar 0.9.4)

4.69 to 6.2.3 is quite a jump in pytest. Is it a python2 or a python3 pytest ?
GDAL is now python 3.

When I started running the autotests recently, I discovered that the
python3 pytest is
/usr/bin/pytest-3
not
/usr/bin/pytest

Assuming this is your problem too,
you could change autotest/GNUmakefile;
I just sym-linked pytest-3 to pytest
Post by Javier Jimenez Shaw
OS: Ubuntu 20.04
Python: 3.8.5
$ apt list --installed | grep gdal
gdal-bin/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
gdal-data/focal,focal,now 3.0.4+dfsg-1build3 all [installed,automatic]
libgdal-dev/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
libgdal26/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]
python3-gdal/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]
Following the instructions in
https://github.com/OSGeo/gdal/blob/master/CONTRIBUTING.md
cd gdal
./configure
make -j8 -s
cd apps; make -s test_ogrsf; cd ..
. scripts/setdevenv.sh
gdalinfo --version
$ GDAL 3.4.0dev-6b8835c2b5, released 2021/06/02
cd ../autotest
pip install -r requirements.txt
python -m pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
--
Andrew C. Aitchison Kendal, UK
***@aitchison.me.uk
Even Rouault
2021-06-02 15:38:23 UTC
Permalink
Javier,

CONTRIBUTING.md was missing the --with-python configure switch to build
the python bindings. Now fixed

So re-run ./configure --with-python && make -j8 -s , and also source
again ". scripts/setdevenv.sh" so that PYTHONPATH is set appropriately

You can check that everything is OK with:

python -c "from osgeo import gdal; print(gdal.__version__)"

Even
Post by Javier Jimenez Shaw
Hello
I am trying to build GDAL (this worked) and run the tests (tons of
failures). Because it is over a clean clone of master, I think there
is something wrong in my configuration. Maybe you can help me.
OS: Ubuntu 20.04
Python: 3.8.5
$ apt list --installed | grep gdal
gdal-bin/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
gdal-data/focal,focal,now 3.0.4+dfsg-1build3 all [installed,automatic]
libgdal-dev/focal,now 3.0.4+dfsg-1build3 amd64 [installed]
libgdal26/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]
python3-gdal/focal,now 3.0.4+dfsg-1build3 amd64 [installed,automatic]
Following the instructions in
https://github.com/OSGeo/gdal/blob/master/CONTRIBUTING.md
<https://github.com/OSGeo/gdal/blob/master/CONTRIBUTING.md>
cd gdal
./configure
make -j8 -s
cd apps; make -s test_ogrsf; cd ..
. scripts/setdevenv.sh
gdalinfo --version
$ GDAL 3.4.0dev-6b8835c2b5, released 2021/06/02
cd ../autotest
pip install -r requirements.txt
python -m pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
rootdir: /home/jshaw/work/gdal/autotest, inifile: pytest.ini,
testpaths: ogr, gcore, gdrivers, osr, alg, gnm, utilities, pyscripts
plugins: sugar-0.9.4, env-0.6.2
collecting ...
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting gcore/multidim.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
gcore/multidim.py:106: in <module>
    ???
E   AttributeError: module 'osgeo.gdal' has no attribute 'GRIORA_RMS'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting alg/fillnodata.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:234: in
pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/lib/python3/dist-packages/_pytest/python.py:410: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:137: in
pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/lib/python3/dist-packages/_pytest/python.py:1015: in parametrize
    ids = self._resolve_arg_ids(argnames, ids, parameters,
item=self.definition)
/usr/lib/python3/dist-packages/_pytest/python.py:1069: in _resolve_arg_ids
    ids = idmaker(argnames, parameters, idfn, ids, self.config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1221: in idmaker
    ids = [
/usr/lib/python3/dist-packages/_pytest/python.py:1222: in <listcomp>
    _idvalset(valindex, parameterset, argnames, idfn, ids,
config=config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1210: in _idvalset
E   TypeError: 'dict_keys' object is not subscriptable
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/test_gdal_utils.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/test_gdal_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/test_gdal_utils.py:37: in <module>
    from osgeo_utils.auxiliary.extent_util import Extent
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/test_pct.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/test_pct.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/test_pct.py:37: in <module>
    from osgeo_utils import gdalattachpct, rgb2pct
E   ModuleNotFoundError: No module named 'osgeo_utils'
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py:36: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting
pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_add_gdal_warp_options_to_string.py:36: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_nb_data_bands.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_nb_data_bands.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_nb_data_bands.py:35: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_option_parser.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_option_parser.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_option_parser.py:37: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_reproject_dataset.py
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_reproject_dataset.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_reproject_dataset.py:36: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_setup_input_srs.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_setup_input_srs.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_setup_input_srs.py:34: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting pyscripts/gdal2tiles/test_setup_no_data_value.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_setup_no_data_value.py'.
Hint: make sure your test modules/packages have valid Python names.
pyscripts/gdal2tiles/test_setup_no_data_value.py:34: in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR
collecting
pyscripts/gdal2tiles/test_update_alpha_value_for_non_alpha_inputs.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ImportError while importing test module
'/home/jshaw/work/gdal/autotest/pyscripts/gdal2tiles/test_update_alpha_value_for_non_alpha_inputs.py'.
Hint: make sure your test modules/packages have valid Python names.
in <module>
    from osgeo_utils import gdal2tiles
E   ModuleNotFoundError: No module named 'osgeo_utils'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Interrupted: 12 errors during collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
If I run a particular file, I get also a many errors (ommited here),
python -m pytest gcore/tiff_read.py
....
 gcore/tiff_read.py ⚯✓s    97% █████████▊
Segmentation fault (core dumped)
Is there anything basically wrong? Am I using the wrong gdal, not the
one just compiled?
Thanks
.___ ._ ..._ .. . ._. .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
_______________________________________________
gdal-dev mailing list
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
Javier Jimenez Shaw
2021-06-02 16:24:41 UTC
Permalink
Thanks Even and Andrew for your answers.

Andrew, somehow I had a workaround for the pytest-3 (that I absolutely
forgot), but thanks for the info.

Even, with the "--with-python" everything goes much better...
Now I can run tiff tests without any failure!
pytest gcore/tiff_*

However, if I run the full test suite, it fails collecting alg/fillnodata.py
(I work it around with "pytest --continue-on-collection-errors")

$ pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
rootdir: /home/jshaw/work/gdal/autotest, inifile: pytest.ini, testpaths:
ogr, gcore, gdrivers, osr, alg, gnm, utilities, pyscripts
plugins: sugar-0.9.4, env-0.6.2
collecting ...
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting alg/fillnodata.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:234: in
pytest_pycollect_makeitem
res = list(collector._genfunctions(name, obj))
/usr/lib/python3/dist-packages/_pytest/python.py:410: in _genfunctions
self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:137: in
pytest_generate_tests
metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/lib/python3/dist-packages/_pytest/python.py:1015: in parametrize
ids = self._resolve_arg_ids(argnames, ids, parameters,
item=self.definition)
/usr/lib/python3/dist-packages/_pytest/python.py:1069: in _resolve_arg_ids
ids = idmaker(argnames, parameters, idfn, ids, self.config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1221: in idmaker
ids = [
/usr/lib/python3/dist-packages/_pytest/python.py:1222: in <listcomp>
_idvalset(valindex, parameterset, argnames, idfn, ids, config=config,
item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1210: in _idvalset
if ids is None or (idx >= len(ids) or ids[idx] is None):
E TypeError: 'dict_keys' object is not subscriptable

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Interrupted: 1 errors during collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Results (5.42s):

Cheers
.___ ._ ..._ .. . ._. .___ .. __ . _. . __.. ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
Post by Even Rouault
Javier,
CONTRIBUTING.md was missing the --with-python configure switch to build
the python bindings. Now fixed
So re-run ./configure --with-python && make -j8 -s , and also source again
". scripts/setdevenv.sh" so that PYTHONPATH is set appropriately
python -c "from osgeo import gdal; print(gdal.__version__)"
Even
Even Rouault
2021-06-02 16:32:02 UTC
Permalink
Post by Javier Jimenez Shaw
However, if I run the full test suite, it fails collecting
alg/fillnodata.py
(I work it around with "pytest --continue-on-collection-errors")
The issue is that pytest 4.6.9 is too old. I've just bumped the min
version to 6.0.0
Post by Javier Jimenez Shaw
$ pytest
Test session starts (platform: linux, Python 3.8.5, pytest 4.6.9,
pytest-sugar 0.9.4)
rootdir: /home/jshaw/work/gdal/autotest, inifile: pytest.ini,
testpaths: ogr, gcore, gdrivers, osr, alg, gnm, utilities, pyscripts
plugins: sugar-0.9.4, env-0.6.2
collecting ...
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
ERROR collecting alg/fillnodata.py
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:234: in
pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/lib/python3/dist-packages/_pytest/python.py:410: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/lib/python3/dist-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3/dist-packages/_pytest/python.py:137: in
pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/lib/python3/dist-packages/_pytest/python.py:1015: in parametrize
    ids = self._resolve_arg_ids(argnames, ids, parameters,
item=self.definition)
/usr/lib/python3/dist-packages/_pytest/python.py:1069: in _resolve_arg_ids
    ids = idmaker(argnames, parameters, idfn, ids, self.config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1221: in idmaker
    ids = [
/usr/lib/python3/dist-packages/_pytest/python.py:1222: in <listcomp>
    _idvalset(valindex, parameterset, argnames, idfn, ids,
config=config, item=item)
/usr/lib/python3/dist-packages/_pytest/python.py:1210: in _idvalset
E   TypeError: 'dict_keys' object is not subscriptable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Interrupted: 1 errors during collection
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Cheers
.___ ._ ..._ .. . ._. .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.
Javier,
CONTRIBUTING.md was missing the --with-python configure switch to
build the python bindings. Now fixed
So re-run ./configure --with-python && make -j8 -s , and also
source again ". scripts/setdevenv.sh" so that PYTHONPATH is set
appropriately
python -c "from osgeo import gdal; print(gdal.__version__)"
Even
--
http://www.spatialys.com
My software is free, but my time generally not.
Loading...