Improve functional tests launcher pytest support 40/104140/5
authorguillaume.lambert <guillaume.lambert@orange.com>
Wed, 25 Jan 2023 11:59:21 +0000 (12:59 +0100)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Mon, 27 Feb 2023 11:25:05 +0000 (11:25 +0000)
Using pytest from the python interpreter can generate unwanted behavior.

https://askubuntu.com/questions/1222958/
why-does-ctrl-c-not-kill-python-running-in-terminal

Typically when using Ctrl-C, subprocess are not properly killed.
This was not happening with nosetests before.
Unfortunately it has been superseded by nose2 which is not properly
working with the current testsuite and is not under active development.

- replace "python3 -m pytest" in launch script by pytest-3 or pytest
  when available.

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I871fa0fce48e176427b07809138a0e4ba1e03247

tests/launch_tests.sh

index 63beeb52887a007137409092f8e18964893bad8b..497209341bde920a81119740c4f095cbc399facc 100755 (executable)
@@ -31,11 +31,19 @@ else
     done
 fi
 if [ -z "$LAUNCHER" ]; then
-    if [ -d "allure-report" ]; then
-        LAUNCHER="python3 -m pytest --alluredir=allure-report/ -q"
+    if [ `which pytest-3` ]; then
+            LAUNCHER="pytest-3"
     else
-        LAUNCHER="python3 -m pytest -q"
+        if [ `which pytest` ]; then
+            LAUNCHER="pytest"
+        else
+            LAUNCHER="python3 -m pytest"
+        fi
+    fi
+    if [ -d "allure-report" ]; then
+        LAUNCHER="$LAUNCHER --alluredir=allure-report/"
     fi
+    LAUNCHER="$LAUNCHER -q"
 fi
 
 for script in $scriptlist; do