[Python-checkins] r50946 - in sandbox/trunk/pdb: mpdb.py test/support.py test/test_mpdb.py test/test_process.py

matt.fleming python-checkins at python.org
Sat Jul 29 21:09:31 CEST 2006


Author: matt.fleming
Date: Sat Jul 29 21:09:31 2006
New Revision: 50946

Modified:
   sandbox/trunk/pdb/mpdb.py
   sandbox/trunk/pdb/test/support.py
   sandbox/trunk/pdb/test/test_mpdb.py
   sandbox/trunk/pdb/test/test_process.py
Log:
Fix tests to work with the latest release of pydb (1.17). 


Modified: sandbox/trunk/pdb/mpdb.py
==============================================================================
--- sandbox/trunk/pdb/mpdb.py	(original)
+++ sandbox/trunk/pdb/mpdb.py	Sat Jul 29 21:09:31 2006
@@ -500,10 +500,9 @@
 
     # Save the old signal handler
     global old_handler
-    old_handler = signal.getsignal(sig)
 
     # Set up the new signal handler
-    signal.signal(sig, signal_handler)
+    old_handler = signal.signal(sig, signal_handler)
 
     global pdbserver_addr
 
@@ -546,7 +545,7 @@
     """ Main entry point to this module. """
     mpdb = MPdb()
     
-    from pydb.fns import process_options
+    from pydb.pydb import process_options
     from optparse import make_option
 
     opt_list = [
@@ -559,9 +558,7 @@
                       + " 'protocol address scriptname'."),
         make_option("-d", "--debug-thread", action="store_true",
                       help="Turn on thread debugging."),
-        make_option("--pid", dest="pid", help="Attach to running process PID."),
-        make_option("-e", "--exec", dest="commands",
-                    help="Specify commands to execute.")
+        make_option("--pid", dest="pid", help="Attach to running process PID.")
         ]
         
     opts = process_options(mpdb, "mpdb", os.path.basename(sys.argv[0])
@@ -584,10 +581,6 @@
         # module search path.
         sys.path[0] = mpdb.main_dirname = os.path.dirname(mpdb.mainpyfile)
 
-    if opts.commands:
-        cmds = opts.commands.split(',')
-        mpdb.cmdqueue = cmds
-        
     if opts.target:
         target(opts.target, opts, mpdb)
         sys.exit()

Modified: sandbox/trunk/pdb/test/support.py
==============================================================================
--- sandbox/trunk/pdb/test/support.py	(original)
+++ sandbox/trunk/pdb/test/support.py	Sat Jul 29 21:09:31 2006
@@ -33,7 +33,7 @@
         self.cmdqueue = cmds
         self.botframe = None
 
-    def msg_nocr(self, msg):
+    def msg_nocr(self, msg, out=None):
         self.lines.append(msg)
 
 

Modified: sandbox/trunk/pdb/test/test_mpdb.py
==============================================================================
--- sandbox/trunk/pdb/test/test_mpdb.py	(original)
+++ sandbox/trunk/pdb/test/test_mpdb.py	Sat Jul 29 21:09:31 2006
@@ -158,53 +158,23 @@
     def testHelpInfo(self):
         self.m.onecmd('help info')
 
-        exp = ['Generic command for showing things about the program being debugged.\n',
-               '\nList of info subcommands:\n\n',
-               'info args --', 'Argument variables of current stack frame\n',
-               'info breakpoints --', 'Status of user-settable breakpoints\n',
-               'info display --', 'Expressions to display when program stops, with code numbers\n',
-               'info globals --', 'Global variables of current stack frame\n',
-               'info line --', 'Current line number in source file\n',
-               'info locals --', 'Local variables of current stack frame\n',
-               'info program --', 'Execution status of the program\n',
-               'info source --', 'Information about the current Python file\n',
-               'info target --', 'Display information about the current target.\n']
-        self.assertEquals(self.m.lines, exp)
+        exp = 'Display information about the current target\n'
+        self.assertEquals(self.m.lines[-1], exp)
         
 
     def testInfoCmd(self):
         self.m.reset()
         self.m.onecmd('info')
-        exp = ['args: ', 'No stack.\n',
-               'breakpoints: ', 'No breakpoints.\n',
-               'display: ', 'There are no auto-display expressions now.\n',
-               'globals: ', 'No frame selected.\n',
-               'line: ', 'No line number information available.\n',
-               'locals: ', 'No frame selected.\n',
-               'program: ', 'The program being debugged is not being run.\n',
-               'source: ', 'No current source file.\n',
-               'target: ', 'target is local\n']
-        self.assertEquals(self.m.lines, exp)
+        exp = 'target is local\n'
+        self.assertEquals(self.m.lines[-1], exp)
 
     def testShowCmd(self):
         self.m.reset()
         self.m.onecmd('show')
 
-        exp =  ['args: ', 'Argument list to give program being debugged when it is started is \n', '"".\n',
-                'basename: ', 'basename is off.\n',
-                'cmdtrace: ', 'cmdtrace is off.\n',
-                # Readline is not always available
-                'debug-signal: ', 'debug-signal not set.\n',
-                'history: ',
-                'interactive: ', 'interactive is on.\n',
-                'linetrace: ', 'line tracing is off.\n',
-                'listsize: ', 'Number of source lines pydb will list by default is 10.\n',
-                'logging: ', 'Future logs will be written to pydb.txt.\n', 'Logs will be appended to the log file.\n', 'Output will be logged and displayed.\n',
-                'prompt: ', 'pydb\'s prompt is "(MPdb)".\n',
-                'target-address: ', "target-address is ''.\n",
-                'version: ', 'pydb version 1.17cvs.\n']
+        exp = "target-address is ''.\n"
 
-        self.assertEquals(self.m.lines, exp)
+        self.assertEquals(self.m.lines[-3], exp)
 
         
 def test_main():

Modified: sandbox/trunk/pdb/test/test_process.py
==============================================================================
--- sandbox/trunk/pdb/test/test_process.py	(original)
+++ sandbox/trunk/pdb/test/test_process.py	Sat Jul 29 21:09:31 2006
@@ -63,7 +63,7 @@
         os.chdir('..')
         time.sleep(0.1)
         os.system("./mpdb.py --exec='set target-address tcp :9000," + \
-                  "attach %s,where,detach' -o %s" % (str(pid), TESTFN))
+                  "attach %s;;where;;detach' -o %s" % (str(pid), TESTFN))
         os.chdir('./test')
         os.kill(pid, signal.SIGINT)
 
@@ -72,7 +72,7 @@
         pid = self.child()
         os.chdir('..')
         time.sleep(0.1)
-        os.system("./mpdb.py --pid='%s tcp :9000' --exec='where,detach' -o %s" \
+        os.system("./mpdb.py --pid='%s tcp :9000' --exec='where;;detach' -o %s" \
                    % (str(pid), TESTFN))
         os.chdir('./test')
         os.kill(pid, signal.SIGINT)


More information about the Python-checkins mailing list