<p>Michael Bradeen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18690">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CI: Use virtual environment for testsuite<br><br>As part of the move to Python3, the testsuite is now designed<br>to work with a virtual environment.<br><br>This change is to have runTestsuite use the venv method if<br>possible and fall back if it can't. If the script is run from<br>an externally activated virtual enviroment, then use that and<br>don't try either method.<br><br>Change-Id: I9724c446d67a5ee9e550644e4a78739de823536e<br>---<br>M tests/CI/runTestsuite.sh<br>1 file changed, 21 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/18690/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/CI/runTestsuite.sh b/tests/CI/runTestsuite.sh</span><br><span>index 466991a..032c43d 100755</span><br><span>--- a/tests/CI/runTestsuite.sh</span><br><span>+++ b/tests/CI/runTestsuite.sh</span><br><span>@@ -12,13 +12,33 @@</span><br><span> </span><br><span> pushd $TESTSUITE_DIR</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+if [[ "$VIRTUAL_ENV" != "" ]]</span><br><span style="color: hsl(120, 100%, 40%);">+then</span><br><span style="color: hsl(120, 100%, 40%);">+ echo "Detected activated virtual environment:"</span><br><span style="color: hsl(120, 100%, 40%);">+ echo $VIRTUAL_ENV</span><br><span style="color: hsl(120, 100%, 40%);">+ echo "Skipping creation of new environment"</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+ python3 -m venv ${TESTSUITE_DIR}/.venv</span><br><span style="color: hsl(120, 100%, 40%);">+ source ${TESTSUITE_DIR}/.venv/bin/activate</span><br><span style="color: hsl(120, 100%, 40%);">+ if [[ "$VIRTUAL_ENV" != "" ]]</span><br><span style="color: hsl(120, 100%, 40%);">+ then</span><br><span style="color: hsl(120, 100%, 40%);">+ echo "Successfully activated virtual environment:"</span><br><span style="color: hsl(120, 100%, 40%);">+ echo $VIRTUAL_ENV</span><br><span style="color: hsl(120, 100%, 40%);">+ python -m pip install --upgrade pip</span><br><span style="color: hsl(120, 100%, 40%);">+ python -m pip install -r requirements.txt</span><br><span style="color: hsl(120, 100%, 40%);">+ python -m pip install -r extras.txt</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ echo "Virtual environment failed, attempting fall-back method"</span><br><span style="color: hsl(120, 100%, 40%);">+ export PYTHONPATH=./lib/python/</span><br><span style="color: hsl(120, 100%, 40%);">+ fi</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ./cleanup-test-remnants.sh</span><br><span> </span><br><span> if [ $REALTIME -eq 1 ] ; then</span><br><span> $CIDIR/setupRealtime.sh --initialize-db=${INITIALIZE_DB:?0}</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-export PYTHONPATH=./lib/python/</span><br><span> echo "Running tests ${TESTSUITE_COMMAND} ${AST_WORK_DIR:+with work directory ${AST_WORK_DIR}}"</span><br><span> ./runtests.py --cleanup --timeout=${TEST_TIMEOUT} ${TESTSUITE_COMMAND} | contrib/scripts/pretty_print --no-color --no-timer --term-width=120 --show-errors || :</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18690">change 18690</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18690"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: development/16/python3 </div>
<div style="display:none"> Gerrit-Change-Id: I9724c446d67a5ee9e550644e4a78739de823536e </div>
<div style="display:none"> Gerrit-Change-Number: 18690 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Michael Bradeen <mbradeen@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>