[Asterisk-code-review] runtests.py: Handle pjproject-bundled pjsua python bindings (testsuite[master])

George Joseph asteriskteam at digium.com
Fri Mar 4 20:42:51 CST 2016


Hello Anonymous Coward #1000019,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/2355

to look at the new patch set (#2).

Change subject: runtests.py:  Handle pjproject-bundled pjsua python bindings
......................................................................

runtests.py:  Handle pjproject-bundled pjsua python bindings

When run with bundled pjproject, the testsuite needs a way to find the python
pjsua bindings installed in astdatadir/third-party-project. Since astdatadir
could be a system installed location like /var/lib/asterisk or in
./astroot/var/lib/asterisk we need to grab the asterisk.conf file in
$AST_TEST_ROOT/etc/asterisk and retrieve it's astdatadir variable. This is the
same logic that the asterisk.Asterisk module uses. So now pjproject_lib =
$AST_TEST_ROOT/<astdatadir>/third-party/pjproject.

Now that we have the path, we need to get it into sys.path.  For runtest.py
itself, we can just sys.path.insert(0, pjproject_lib).  This puts it at the
front of the search order so it'll override any system-installed pjproject. The
tests run in a separate process though so adding to sys.path in runtests.py
doesn't do them any good.  So additionally, we also now update the PYTHONPATH
environment variable with 'lib/python' and pjproject_lib so the test processes
inherit it.

BTW, resetting PYTHONPATH eliminates the need to explicitly add lib/python to
sys.path in any custom python used by the tests.  A future patch can remove
them and any future needs for adding module search paths can be handled
right in runtests.py.

Change-Id: Ib0464c8507da7b030b887abfeef89e5bd2c03cf2
---
M lib/python/asterisk/test_suite_utils.py
M runtests.py
2 files changed, 62 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/55/2355/2
-- 
To view, visit https://gerrit.asterisk.org/2355
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib0464c8507da7b030b887abfeef89e5bd2c03cf2
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019



More information about the asterisk-code-review mailing list