[asterisk-commits] pabelanger: branch pabelanger/RemoveOptionParser r1918 - in /asterisk/team/pa...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 25 13:09:31 CDT 2011


Author: pabelanger
Date: Thu Aug 25 13:09:27 2011
New Revision: 1918

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1918
Log:
Start remove OptionParser logic

Modified:
    asterisk/team/pabelanger/RemoveOptionParser/lib/python/asterisk/TestCase.py
    asterisk/team/pabelanger/RemoveOptionParser/runtests.py
    asterisk/team/pabelanger/RemoveOptionParser/tests/fastagi/execute/run-test

Modified: asterisk/team/pabelanger/RemoveOptionParser/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/RemoveOptionParser/lib/python/asterisk/TestCase.py?view=diff&rev=1918&r1=1917&r2=1918
==============================================================================
--- asterisk/team/pabelanger/RemoveOptionParser/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/pabelanger/RemoveOptionParser/lib/python/asterisk/TestCase.py Thu Aug 25 13:09:27 2011
@@ -9,7 +9,7 @@
 
 import sys
 import logging
-from optparse import OptionParser
+import os
 from twisted.internet import reactor
 from starpy import manager, fastagi
 
@@ -31,18 +31,8 @@
         argv --
 
         """
-        # get version info
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                help="Asterisk version string")
-        parser.add_option("-n", dest="test_name",
-                help="Test name")
-        parser.add_option("--valgrind", action="store_true",
-                dest="valgrind", default=False,
-                help="Run Asterisk under valgrind.")
-
-        (self.options, args) = parser.parse_args(argv)
-        self.options.base = self.options.test_name.lstrip("tests/")
+        self.test_name = os.path.dirname(sys.argv[0])
+        self.base = self.test_name.lstrip("tests/")
 
         reactor.callWhenRunning(self.run)
 
@@ -55,14 +45,14 @@
         """
         for c in range(count):
             print "Creating Asterisk instance %d ..." % (c + 1)
-            self.ast.append(Asterisk(base=self.options.base))
-            self.ast[c].valgrind = self.options.valgrind
+            self.ast.append(Asterisk(base=self.base))
+#            self.ast[c].valgrind = self.options.valgrind
             # Copy shared config files
             self.ast[c].install_configs("%s/configs" %
-                    (self.options.test_name))
+                    (self.test_name))
             # Copy test specific config files
             self.ast[c].install_configs("%s/configs/ast%d" %
-                    (self.options.test_name, c + 1))
+                    (self.test_name, c + 1))
 
     def create_ami_factory(self, count=1, username="user", secret="mysecret", port=5038):
         """

Modified: asterisk/team/pabelanger/RemoveOptionParser/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/RemoveOptionParser/runtests.py?view=diff&rev=1918&r1=1917&r2=1918
==============================================================================
--- asterisk/team/pabelanger/RemoveOptionParser/runtests.py (original)
+++ asterisk/team/pabelanger/RemoveOptionParser/runtests.py Thu Aug 25 13:09:27 2011
@@ -157,8 +157,6 @@
         start_time = time.time()
         cmd = [
             "%s/run-test" % self.test_name,
-            "-v", str(self.ast_version),
-            "-n", str(self.test_name)
         ]
         if self.options.valgrind:
             cmd.append("--valgrind")

Modified: asterisk/team/pabelanger/RemoveOptionParser/tests/fastagi/execute/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/RemoveOptionParser/tests/fastagi/execute/run-test?view=diff&rev=1918&r1=1917&r2=1918
==============================================================================
--- asterisk/team/pabelanger/RemoveOptionParser/tests/fastagi/execute/run-test (original)
+++ asterisk/team/pabelanger/RemoveOptionParser/tests/fastagi/execute/run-test Thu Aug 25 13:09:27 2011
@@ -33,15 +33,6 @@
         self.overall_result = True
         self.agi = ""
 
-        parser = OptionParser()
-        parser.add_option("-v", "--version", dest="ast_version",
-                          help="Asterisk version string")
-        parser.add_option("-n", dest="test_name",
-                help="Test name")
-
-        (options, args) = parser.parse_args(argv)
-        self.ast_version = AsteriskVersion(options.ast_version)
-
         # Listen for results from dialplan
         self.agi_factory = fastagi.FastAGIFactory(self.do_test)
         reactor.listenTCP(4573, self.agi_factory, self.timeout, '127.0.0.1')




More information about the asterisk-commits mailing list