[Asterisk-code-review] Begin work on python3 compatability. (testsuite[master])

Corey Farrell asteriskteam at digium.com
Mon Apr 23 22:01:38 CDT 2018


Hello Jenkins2, 

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

    https://gerrit.asterisk.org/8854

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

Change subject: Begin work on python3 compatability.
......................................................................

Begin work on python3 compatability.

* Use explicit relative import syntax.
* Correct syntax for print and except.
* Fix incorrect usage of IOError in astcdr.py - IOError is not a tuple.
* Use items, values instead of iteritems, itervalues.
* Use OrderedDict from collections if available (python 2.7+).
* Do not unpack tuples from argument list, save tuple to variable then
  unpack within code.
* Use exception handler to import Python3 version of urlencode if the
  Python2 version fails to import.
* Remove unused import unittest from opensslversion.
* Move executable tests to separate files to resolve issues with
  relative imports:
  - buildoptions
  - cdr
  - cel
  - channel_test_condition
  - config
  - lock_test_condition
  - sip_dialog_test_condition (disabled)
  - sippversion
* Remove unused executable flag and shebang from phones.py.
* Update self_test script to run tests from new location.
* Remove ability to use config.py to display a config file.
* Allow PYTHON environmental variable to tell run-local to use a
  specific python binary.
* Execute test_runner.py using python -m syntax.  This avoids conflicts
  between needing to use relative imports for modules but not being
  allowed to use them in executable scripts.
* Encode self.realbase for use with md5 function.
* Update test_runner.load_and_parse_module to use full module name by
  prepending "asterisk.".
* Remove executable flag and shebang from test_runner.py.  Remove
  redundant appending of sys.path.

It is not yet possible to run the testsuite using python3.  Many string
encoding errors need to be resolved first and starpy needs to be
updated.  Some parts of lib/python contain unit tests, they can be run
using ./self_test.  This will test with both python2 and python3 if they
are installed.

Change-Id: If76c2d3e11e4ab4552d0df7841287c8bb2de7918
---
M lib/python/asterisk/ami.py
M lib/python/asterisk/apptest.py
M lib/python/asterisk/ari.py
M lib/python/asterisk/astconfigparser.py
M lib/python/asterisk/astcsv.py
M lib/python/asterisk/astdicts.py
M lib/python/asterisk/asterisk.py
M lib/python/asterisk/bridge_test_case.py
M lib/python/asterisk/buildoptions.py
M lib/python/asterisk/cdr.py
M lib/python/asterisk/cel.py
M lib/python/asterisk/channel_test_condition.py
M lib/python/asterisk/confbridge.py
M lib/python/asterisk/config.py
M lib/python/asterisk/fd_test_condition.py
M lib/python/asterisk/lock_test_condition.py
M lib/python/asterisk/opensslversion.py
M lib/python/asterisk/originate.py
M lib/python/asterisk/pcap.py
M lib/python/asterisk/phones.py
M lib/python/asterisk/pjsua_mod.py
M lib/python/asterisk/pluggable_modules.py
M lib/python/asterisk/pluggable_registry.py
M lib/python/asterisk/realtime_converter.py
M lib/python/asterisk/realtime_odbc_module.py
M lib/python/asterisk/realtime_test_module.py
A lib/python/asterisk/self_test/harness_shared.py
A lib/python/asterisk/self_test/locks-backtrace.txt
A lib/python/asterisk/self_test/locks-fail.txt
A lib/python/asterisk/self_test/locks-large-multiple-object.txt
A lib/python/asterisk/self_test/locks-multiple-objects-no-backtrace.txt
A lib/python/asterisk/self_test/locks-pass.txt
A lib/python/asterisk/self_test/locks-single-object-no-held-info.txt
A lib/python/asterisk/self_test/locks-single-object.txt
A lib/python/asterisk/self_test/test_buildoptions.py
A lib/python/asterisk/self_test/test_cdr.py
A lib/python/asterisk/self_test/test_cel.py
A lib/python/asterisk/self_test/test_channel_test_condition.py
A lib/python/asterisk/self_test/test_config.py
A lib/python/asterisk/self_test/test_lock_test_condition.py
A lib/python/asterisk/self_test/test_sip_dialog_test_condition.py.txt
A lib/python/asterisk/self_test/test_sippversion.py
M lib/python/asterisk/sip_channel_test_condition.py
M lib/python/asterisk/sip_dialog_test_condition.py
M lib/python/asterisk/sipp.py
M lib/python/asterisk/sippversion.py
M lib/python/asterisk/syncami.py
M lib/python/asterisk/test_case.py
M lib/python/asterisk/test_conditions.py
M lib/python/asterisk/test_config.py
M lib/python/asterisk/test_runner.py
M lib/python/asterisk/test_suite_utils.py
M lib/python/asterisk/thread_test_condition.py
M lib/python/asterisk/voicemail.py
M lib/python/mockd.py
M lib/python/rlmi.py
M lib/python/sip_message.py
M run-local
M runtests.py
M self_test
M usage.py
61 files changed, 1,816 insertions(+), 1,737 deletions(-)


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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If76c2d3e11e4ab4552d0df7841287c8bb2de7918
Gerrit-Change-Number: 8854
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180423/4046441e/attachment-0001.html>


More information about the asterisk-code-review mailing list