SyntaxError: future feature annotations is not defined
Some unit test fail when running them with the official QGIS docker image:
https://bitbucket.org/hu-geomatics/enmap-box/addon/pipelines/home#!/results/374
e.g.
python3 -m coverage run --rcfile=.coveragec --append hubdc/test/test_algorithm.py
ends up in:
.scripts/runtests.sh: line 30: 1268 Segmentation fault (core dumped) python3 -m coverage run --rcfile=.coveragec --append enmapboxtesting/test_utils.py
Traceback (most recent call last):
File "hubdc/test/test_algorithm.py", line 4, in <module>
from hubdc.algorithm.sampling import sample_points, sample_polygons
File "/opt/atlassian/pipelines/agent/build/hubdc/algorithm/sampling.py", line 1
from __future__ import annotations
^
SyntaxError: future feature annotations is not defined
Maybe it’s just a matter of the python version.
Comments (11)
-
-
reporter Mmmh. minimum QGIS requirements are 3.6.
Are these future annotations that important? I mean, they are not even standard in 3.7
-
I use it a lot. So then let’s exclude such tests until Python 3.7 is available.
-
reporter I thinks it’s best if you add a
@unittest.skipIf
that checks for the recent python version and skips all tests that required a higher python version. -
Yes, sounds good.
@Benjamin Jakimow please examplify how to use
@unittest.skipIf
correctly (e.g. code snippet) -
reporter Let me google that for you
https://docs.python.org/3.6/library/unittest.html#skipping-tests-and-expected-failures
-
- changed status to resolved
resolves
#374→ <<cset 33e35b662794>>
-
reporter I’ll try to find a way that the qgis docker image uses python 3.7. However, I still think it’s not a good idea to not support the minimum python version the latest QGIS is working with. In particular as the qgis docker image is a reference implementation and might be used in many environments.
-
I don’t know, Python 3.5 is 4.5 years old. I would like to also use more recent language features.
-
reporter The QGIS docker image defaults to python 3.6. This seems to be the standard for ubuntu, e.g. on BB8 as well.
I changed the pipeline to the miniconda qgis, which might ease the handling of requirements and allows us to define and test the enmapbox in different python version.
-
reporter addresses
#374CI unit test in python >= 3.7→ <<cset 1620aa5e919c>>
- Log in to comment
Yes, it the Python version: https://stackoverflow.com/questions/52889746/cant-import-annotations-from-future/52890129
We need Python 3.7!