[Asterisk-code-review] CI: use Python3 virtual environment (asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Aug 30 13:43:48 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19017 )

Change subject: CI: use Python3 virtual environment
......................................................................

CI: use Python3 virtual environment

Requires Python3 testsuite changes

ASTERISK-26826

Change-Id: I92ec7dec751ad455503a584d6e860db88c56d6bc
---
M tests/CI/runTestsuite.sh
1 file changed, 11 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/CI/runTestsuite.sh b/tests/CI/runTestsuite.sh
index 466991a..2308349 100755
--- a/tests/CI/runTestsuite.sh
+++ b/tests/CI/runTestsuite.sh
@@ -4,6 +4,7 @@
 TEST_TIMEOUT=600
 source $CIDIR/ci.functions
 ASTETCDIR=$DESTDIR/etc/asterisk
+SETUPVENV=$TESTSUITE_DIR/setupVenv.sh
 
 if [ x"$WORK_DIR" != x ] ; then
 	export AST_WORK_DIR="$(readlink -f $WORK_DIR)"
@@ -11,16 +12,23 @@
 fi
 
 pushd $TESTSUITE_DIR
-
 ./cleanup-test-remnants.sh
 
 if [ $REALTIME -eq 1 ] ; then
 	$CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0}
 fi
 
-export PYTHONPATH=./lib/python/
+# check to see if venv scripts exist so we can use them
+if [ -f "$SETUPVENV" ] ; then
+	# explicitly invoking setupVenv to capture output in case of failure
+	./setupVenv.sh
+	VENVPREFIX="runInVenv.sh python "
+else
+	export PYTHONPATH=./lib/python/
+fi
+
 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 || :
+./${VENVPREFIX}runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || :
 
 if [ $REALTIME -eq 1 ] ; then
 	$CIDIR/teardownRealtime.sh --cleanup-db=${CLEANUP_DB:?0}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19017
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I92ec7dec751ad455503a584d6e860db88c56d6bc
Gerrit-Change-Number: 19017
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220830/391f506c/attachment.html>


More information about the asterisk-code-review mailing list