SyntaxError: future feature annotations is not defined

Issue #374 resolved
Benjamin Jakimow created an issue

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)

  1. Benjamin Jakimow reporter

    Mmmh. minimum QGIS requirements are 3.6.

    Are these future annotations that important? I mean, they are not even standard in 3.7

  2. Benjamin Jakimow 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.

  3. Andreas Janz

    Yes, sounds good.

    @Benjamin Jakimow please examplify how to use @unittest.skipIf correctly (e.g. code snippet)

  4. Benjamin Jakimow 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.

  5. Andreas Janz

    I don’t know, Python 3.5 is 4.5 years old. I would like to also use more recent language features.

  6. Benjamin Jakimow 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.

  7. Log in to comment