[Python-checkins] r51257 - in sandbox/trunk/pdb: mconnection.py mproc.py mremote.py test/test_process.py
matt.fleming
python-checkins at python.org
Sun Aug 13 20:36:37 CEST 2006
Author: matt.fleming
Date: Sun Aug 13 20:36:37 2006
New Revision: 51257
Modified:
sandbox/trunk/pdb/mconnection.py
sandbox/trunk/pdb/mproc.py
sandbox/trunk/pdb/mremote.py
sandbox/trunk/pdb/test/test_process.py
Log:
More unit test changes.
Modified: sandbox/trunk/pdb/mconnection.py
==============================================================================
--- sandbox/trunk/pdb/mconnection.py (original)
+++ sandbox/trunk/pdb/mconnection.py Sun Aug 13 20:36:37 2006
@@ -39,7 +39,10 @@
def import_hook(target):
cls = target[target.rfind('.')+1:]
target = target[:target.rfind('.')]
- pkg = __import__(target, globals(), locals(), [])
+ try:
+ pkg = __import__(target, globals(), locals(), [])
+ except ImportError:
+ return None
return getattr(pkg, cls)
class MConnectionClientFactory:
Modified: sandbox/trunk/pdb/mproc.py
==============================================================================
--- sandbox/trunk/pdb/mproc.py (original)
+++ sandbox/trunk/pdb/mproc.py Sun Aug 13 20:36:37 2006
@@ -8,6 +8,7 @@
"""
def __init__(self, mpdb_object):
RemoteWrapperClient.__init__(self, mpdb_object)
+ self.cmdqueue = self.mpdb.cmdqueue
self.debug_signal = None
def do_detach(self, args):
Modified: sandbox/trunk/pdb/mremote.py
==============================================================================
--- sandbox/trunk/pdb/mremote.py (original)
+++ sandbox/trunk/pdb/mremote.py Sun Aug 13 20:36:37 2006
@@ -39,6 +39,7 @@
self.do_rquit(None)
else:
self.msg("Re exec'ing\n\t%s" % self._sys_argv)
+ import os
os.execvp(self._sys_argv[0], self._sys_argv)
def do_rquit(self, arg):
@@ -88,7 +89,7 @@
from mconnection import MConnectionServerFactory, ConnectionFailed
self.connection = MConnectionServerFactory.create(target)
if self.connection is None:
- self.msg('Unknown protocol')
+ self.errmsg('Unknown protocol')
return
try:
self.msg('Listening on: %s' % comm)
Modified: sandbox/trunk/pdb/test/test_process.py
==============================================================================
--- sandbox/trunk/pdb/test/test_process.py (original)
+++ sandbox/trunk/pdb/test/test_process.py Sun Aug 13 20:36:37 2006
@@ -10,7 +10,7 @@
import unittest
from test import test_support
-from support import DummyStdout, MPdbTest, MPdbTestThread
+from support import DummyStdout, MPdbTest, MPdbTestThread, MPdbTestProc
sys.path.append('..')
@@ -40,16 +40,18 @@
sys.stdout = sys.__stdout__
- def testSignalHandler(self):
+ def no_testSignalHandler(self):
pid = self.child()
- client = MPdbTest()
+ client = MPdbTestProc(mpdb.MPdb())
# Allow the child process to catch up
time.sleep(0.1)
+
client.onecmd('set target-address tcp :9000')
client.onecmd('attach %s' % str(pid))
client.onecmd('where')
line = client.lines[1]
self.assertEquals(line, ' <module>\n(MPdb)')
+
try:
client.onecmd('detach')
except KeyboardInterrupt:
@@ -62,18 +64,8 @@
pid = self.child()
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))
- os.chdir('./test')
- os.kill(pid, signal.SIGINT)
-
- os.waitpid(pid, 0)
-
- pid = self.child()
- os.chdir('..')
- time.sleep(0.1)
- os.system("./mpdb.py --pid='%s tcp :9000' --exec='where;;detach' -o %s" \
- % (str(pid), TESTFN))
+ os.system("./mpdb.py -e 'detach' --pid='%s tcp :9000'" \
+ % (str(pid)))
os.chdir('./test')
os.kill(pid, signal.SIGINT)
More information about the Python-checkins
mailing list