[Asterisk-code-review] CI: Use virtual environment for testsuite (asterisk[development/16/python3])
Michael Bradeen
asteriskteam at digium.com
Fri Jun 24 12:20:35 CDT 2022
Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18690 )
Change subject: CI: Use virtual environment for testsuite
......................................................................
CI: Use virtual environment for testsuite
As part of the move to Python3, the testsuite is now designed
to work with a virtual environment.
This change is to have runTestsuite use the venv method if
possible and fall back if it can't. If the script is run from
an externally activated virtual enviroment, then use that and
don't try either method.
Change-Id: I9724c446d67a5ee9e550644e4a78739de823536e
---
M tests/CI/runTestsuite.sh
1 file changed, 21 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/18690/1
diff --git a/tests/CI/runTestsuite.sh b/tests/CI/runTestsuite.sh
index 466991a..032c43d 100755
--- a/tests/CI/runTestsuite.sh
+++ b/tests/CI/runTestsuite.sh
@@ -12,13 +12,33 @@
pushd $TESTSUITE_DIR
+if [[ "$VIRTUAL_ENV" != "" ]]
+then
+ echo "Detected activated virtual environment:"
+ echo $VIRTUAL_ENV
+ echo "Skipping creation of new environment"
+else
+ python3 -m venv ${TESTSUITE_DIR}/.venv
+ source ${TESTSUITE_DIR}/.venv/bin/activate
+ if [[ "$VIRTUAL_ENV" != "" ]]
+ then
+ echo "Successfully activated virtual environment:"
+ echo $VIRTUAL_ENV
+ python -m pip install --upgrade pip
+ python -m pip install -r requirements.txt
+ python -m pip install -r extras.txt
+ else
+ echo "Virtual environment failed, attempting fall-back method"
+ export PYTHONPATH=./lib/python/
+ fi
+fi
+
./cleanup-test-remnants.sh
if [ $REALTIME -eq 1 ] ; then
$CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0}
fi
-export PYTHONPATH=./lib/python/
echo "Running tests ${TESTSUITE_COMMAND} ${AST_WORK_DIR:+with work directory ${AST_WORK_DIR}}"
./runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || :
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18690
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: development/16/python3
Gerrit-Change-Id: I9724c446d67a5ee9e550644e4a78739de823536e
Gerrit-Change-Number: 18690
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220624/e06664d9/attachment.html>
More information about the asterisk-code-review
mailing list