This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16542 )
Change subject: osmoappdesc.py, tests: switch to python 3
......................................................................
osmoappdesc.py, tests: switch to python 3
Make build and external tests work with python3, so we can drop
the python2 dependency.
This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.
Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I344c49001fba23bdcfdef06ab174c52b60edd01c
---
M osmoappdesc.py
M tests/vty/vty_test_runner.py
2 files changed, 17 insertions(+), 17 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/42/16542/1
diff --git a/osmoappdesc.py b/osmoappdesc.py
index 02ccda6..6c1bafa 100644
--- a/osmoappdesc.py
+++ b/osmoappdesc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
app_configs = {
"osmo-stp": ["doc/examples/osmo-stp.cfg"],
diff --git a/tests/vty/vty_test_runner.py b/tests/vty/vty_test_runner.py
index 47ce23c..605bc93 100755
--- a/tests/vty/vty_test_runner.py
+++ b/tests/vty/vty_test_runner.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# (C) 2013 by Katerina Barone-Adesi <kat.obsc at gmail.com>
# (C) 2013 by Holger Hans Peter Freyther
@@ -35,9 +35,9 @@
def checkForEndAndExit(self):
res = self.vty.command("list")
#print ('looking for "exit"\n')
- self.assert_(res.find(' exit\r') > 0)
+ self.assertTrue(res.find(' exit\r') > 0)
#print 'found "exit"\nlooking for "end"\n'
- self.assert_(res.find(' end\r') > 0)
+ self.assertTrue(res.find(' end\r') > 0)
#print 'found "end"\n'
def vty_command(self):
@@ -56,8 +56,8 @@
try:
self.proc = osmoutil.popen_devnull(osmo_vty_cmd)
except OSError:
- print >> sys.stderr, "Current directory: %s" % os.getcwd()
- print >> sys.stderr, "Consider setting -b"
+ print("Current directory: %s" % os.getcwd(), file=sys.stderr)
+ print("Consider setting -b", file=sys.stderr)
appstring = self.vty_app()[2]
appport = self.vty_app()[0]
@@ -89,22 +89,22 @@
line = fp.readline().strip()
if not line:
return False
- print "%s: parsing line: %s" %(path, line)
+ print("%s: parsing line: %s" %(path, line))
it = line.split()
if lport == int(it[5]):
- print "%s: local port %d found" %(path, lport)
+ print("%s: local port %d found" %(path, lport))
itaddr_list = it[8:]
if len(itaddr_list) != len(laddr_list):
- print "%s: addr list mismatch: %r vs %r" % (path, repr(itaddr_list), repr(laddr_list))
+ print("%s: addr list mismatch: %r vs %r" % (path, repr(itaddr_list), repr(laddr_list)))
continue
for addr in laddr_list:
if addr not in itaddr_list:
- print "%s: addr not found in list: %s vs %r" % (path, addr, repr(itaddr_list))
+ print("%s: addr not found in list: %s vs %r" % (path, addr, repr(itaddr_list)))
return False
return True
return False
except IOError as e:
- print "I/O error({0}): {1}".format(e.errno, e.strerror)
+ print("I/O error({0}): {1}".format(e.errno, e.strerror))
return False
def testMultiHome(self):
@@ -115,9 +115,9 @@
found = True
break
else:
- print "[%d] osmo-stp not yet available, retrying in a second" % i
+ print("[%d] osmo-stp not yet available, retrying in a second" % i)
time.sleep(1)
- self.assert_(found)
+ self.assertTrue(found)
try:
proto = socket.IPPROTO_SCTP
except AttributeError: # it seems to be not defined under python2?
@@ -128,8 +128,8 @@
s.connect(('127.0.0.2',2905))
except socket.error as msg:
s.close()
- self.assert_(False)
- print "Connected to STP through SCTP"
+ self.assertTrue(False)
+ print("Connected to STP through SCTP")
s.close()
if __name__ == '__main__':
@@ -158,9 +158,9 @@
if args.p:
confpath = args.p
- print "confpath %s, workdir %s" % (confpath, workdir)
+ print("confpath %s, workdir %s" % (confpath, workdir))
os.chdir(workdir)
- print "Running tests for specific VTY commands"
+ print("Running tests for specific VTY commands")
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYSTP))
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16542
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I344c49001fba23bdcfdef06ab174c52b60edd01c
Gerrit-Change-Number: 16542
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191211/39bcdb8b/attachment.htm>