From 5f62b71528d449635292ae3e4470115ae2500f75 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 30 Oct 2023 11:35:41 -0400 Subject: [PATCH] Fix: tests: use local typing.py for Python 3.5 `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 import normand File "/home/smarchi/src/babeltrace/tests/utils/python/normand.py", line 61, in 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 Reviewed-on: https://review.lttng.org/c/babeltrace/+/11172 CI-Build: Michael Jeanson Reviewed-by: Philippe Proulx Reviewed-by: Michael Jeanson Tested-by: jenkins --- tests/utils/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index da389f38..e2b73092 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -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" -- 2.34.1