<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8964">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Add self_test script.<br><br>This script will be used by jenkins to run python unit tests.  The<br>primary goal is to avoid having jenkins depend on location of the unit<br>tests.  For now it includes specific tests that jenkins has been running<br>from lib/python/asterisk, plus all tests in<br>lib/python/asterisk/self_test.  Anything in the self_test folder is<br>expected to pass under both python2 and python3.<br><br>Change-Id: Ie6fe082b1a2d46b229bab27abed97e85ad6c4f13<br>---<br>A self_test<br>1 file changed, 43 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/self_test b/self_test<br>new file mode 100755<br>index 0000000..240bfcb<br>--- /dev/null<br>+++ b/self_test<br>@@ -0,0 +1,43 @@<br>+#!/usr/bin/sh -e<br>+<br>+PYTHON=""<br>+PYTHON2=$(which python2 2>/dev/null || true)<br>+PYTHON3=$(which python3 2>/dev/null || true)<br>+<br>+if test -z "$PYTHON2$PYTHON3"; then<br>+   PYTHON=$(which python 2>/dev/null || true)<br>+<br>+     if test -z "$PYTHON"; then<br>+         echo "No python binary found, cannot run any tests"<br>+                exit 1<br>+       fi<br>+fi<br>+<br>+run_test() {<br>+    # Arguments: test_name python_name python_bin<br>+        if test -n "$3"; then<br>+              echo " ==> Executing $1 ($2)"<br>+           $3 lib/python/asterisk/self_test/${1}.py<br>+     fi<br>+}<br>+<br>+ALL_TESTS=$(find lib/python/asterisk/self_test -name 'test_*.py' -exec basename '{}' .py \;)<br>+for i in $ALL_TESTS; do<br>+   run_test $i python $PYTHON<br>+   run_test $i python2 $PYTHON2<br>+ run_test $i python3 $PYTHON3<br>+done<br>+<br>+# Temporary code for running unit tests that are not compatible with python3<br>+run_legacy_test() {<br>+  # Arguments: test_name python_name python_bin<br>+        if test -n "$3"; then<br>+              echo " ==> Executing $1 ($2)"<br>+           $3 lib/python/asterisk/${1}.py<br>+       fi<br>+}<br>+<br>+for i in buildoptions channel_test_condition sippversion; do<br>+     run_legacy_test $i python $PYTHON<br>+    run_legacy_test $i python2 $PYTHON2<br>+done<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8964">change 8964</a>. To unsubscribe, 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/8964"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 15.4 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie6fe082b1a2d46b229bab27abed97e85ad6c4f13 </div>
<div style="display:none"> Gerrit-Change-Number: 8964 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>