Fix: tests: use local typing.py for Python 3.5
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 30 Oct 2023 15:35:41 +0000 (11:35 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 31 Oct 2023 16:54:08 +0000 (12:54 -0400)
`typing.NoReturn` was introduced in Python 3.5.4.  Therefore, there are
releases of Python 3.5 with which we get errors like:

    # Running: python3 /home/smarchi/src/babeltrace/tests/utils/python/mctf.py --base-dir /tmp/test-stored-value.jJOHoog/stored-values /home/smarchi/src/babeltrace/tests/data/ctf-traces/live/stored-values.mctf
    Traceback (most recent call last):
      File "/home/smarchi/src/babeltrace/tests/utils/python/mctf.py", line 13, in <module>
        import normand
      File "/home/smarchi/src/babeltrace/tests/utils/python/normand.py", line 61, in <module>
        from typing import Any, Set, Dict, List, Union, Pattern, Callable, NoReturn, Optional
    ImportError: cannot import name 'NoReturn'

Fix that by using our local typing module for Python 3.5.

Change-Id: I5660a5e0e2014a71c5e6b98b6ce1970b5bb1226e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11172
CI-Build: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
tests/utils/utils.sh

index da389f38b34068253113faa3b1f24ba83b97c9ca..e2b730923685828301a158ecbba35a19e3fc1402 100644 (file)
@@ -309,7 +309,7 @@ check_coverage() {
 run_python() {
        local our_pythonpath="${BT_TESTS_SRCDIR}/utils/python"
 
-       if [[ $BT_TESTS_PYTHON_VERSION = 3.4 ]]; then
+       if [[ $BT_TESTS_PYTHON_VERSION =~ 3.[45] ]]; then
                # Add a local directory containing a `typing.py` to `PYTHONPATH` for
                # Python 3.4 which doesn't offer the `typing` module.
                our_pythonpath="$our_pythonpath:${BT_TESTS_SRCDIR}/utils/python/typing"
This page took 0.025366 seconds and 4 git commands to generate.