Add allure-pytest tox profiles for local use 60/102260/7
authorTianliang Zhang <zhangtleon@gmail.com>
Thu, 15 Sep 2022 14:24:41 +0000 (16:24 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Thu, 15 Sep 2022 14:50:34 +0000 (16:50 +0200)
When the allure-report folder is present, the default launcher for tests
currently based on pytest now uses allure report related options.

"allure serve tests/allure-report/" can be rund afterwards to view the
report in browser.

These capacities have been scripted in tox and are now used by default
to ensure CI.

JIRA: TRNSPRTPCE-685
Change-Id: Ic27b3efa1a77c1f2c55338861b8a6f60f9c47e02
Co-authored-by: guillaume.lambert <guillaume.lambert@orange.com>
Signed-off-by: Tianliang Zhang <zhangtleon@gmail.com>
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
.gitignore
tests/launch_tests.sh
tests/test-requirements.txt
tox.ini

index 70b203cd9db267d997ef74c669fbb1132387c9ef..cb9c68d78e0d7418340a22203eacc1fdd1113ce4 100644 (file)
@@ -20,9 +20,10 @@ classes
 .DS_STORE
 .metadata
 ordmodels/src/main/java
+tests/allure-report/
 tests/config.xml
 tests/models
-<<<<<<< HEAD
+tests/test-requirements.txt
 *.log
 *.log.*
 __pycache__
index 54d1cd1033eb34aca16125e960b430bfd71d2718..63beeb52887a007137409092f8e18964893bad8b 100755 (executable)
@@ -31,7 +31,11 @@ else
     done
 fi
 if [ -z "$LAUNCHER" ]; then
-    LAUNCHER="python3 -m pytest -q";
+    if [ -d "allure-report" ]; then
+        LAUNCHER="python3 -m pytest --alluredir=allure-report/ -q"
+    else
+        LAUNCHER="python3 -m pytest -q"
+    fi
 fi
 
 for script in $scriptlist; do
index 2049e9133df8777b93e138827476059dd4089395..8ea5b14c73b1d3df70b3243bc7c98be0e3448bd8 100644 (file)
@@ -1 +1,2 @@
+## Caution this file is in .gitignore
 pytest # MIT License
diff --git a/tox.ini b/tox.ini
index 075341b0c6e2fd0fc380cc0ed74bc69eb086a355..3baf8b2587b76abeaa1b543df217d39e08e8d237 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -323,3 +323,22 @@ deps = gitlint
 commands =
     gitlint --config ../.gitlint
 
+
+[testenv:allure-report-init]
+basepython = python3
+deps = allure-pytest>=2.10.0
+# allure is under Apache License 2.0
+whitelist_externals =
+    mkdir
+    sed
+commands =
+    mkdir -p allure-report
+    sed -i_ '$a\allure-pytest # Apache License 2.0' ./test-requirements.txt
+
+
+[testenv:allure-report-serve]
+basepython = python3
+whitelist_externals =
+    allure
+commands =
+    allure serve "allure-report"