How to use pydevd - 10 common examples

To help you get started, we’ve selected a few pydevd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId, frameId, line = self.WaitForBreakpointHit('111', True) #not a return (it stopped in the other breakpoint)
        
        assert line == 6, 'Expected return to be in line 6, was: %s' % line
        
        self.WriteRunThread(threadId)

        assert 13 == self._sequence, 'Expected 13. Had: %s' % self._sequence
        
        self.finishedOk = True
        


#=======================================================================================================================
# WriterThreadCase11
#======================================================================================================================
class WriterThreadCase11(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case10.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(2, 'Method1') 
        self.WriteMakeInitialRun()
        
        threadId, frameId = self.WaitForBreakpointHit('111')
        
        self.WriteStepOver(threadId)
        
        threadId, frameId, line = self.WaitForBreakpointHit('108', True)
        
        assert line == 3, 'Expected return to be in line 3, was: %s' % line
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
def WriteSuspendThread(self, threadId):
        self.Write("105\t%s\t%s" % (self.NextSeq(), threadId,))
        
    def WriteRunThread(self, threadId):
        self.Write("106\t%s\t%s" % (self.NextSeq(), threadId,))
        
    def WriteKillThread(self, threadId):
        self.Write("104\t%s\t%s" % (self.NextSeq(), threadId,))

    def WriteDebugConsoleExpression(self, locator):
        self.Write("126\t%s\t%s"%(self.NextSeq(), locator))

#=======================================================================================================================
# WriterThreadCase14 - [Test Case]: Interactive Debug Console
#======================================================================================================================
class WriterThreadCase14(AbstractWriterThread):

    TEST_FILE = NormFile('_debugger_case14.py')

    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(22, 'main')
        self.WriteMakeInitialRun()

        threadId, frameId, line = self.WaitForBreakpointHit('111', True)

        # Access some variable
        self.WriteDebugConsoleExpression("%s\t%s\tEVALUATE\tcarObj.color"%(threadId, frameId))
        self.WaitForMultipleVars(['False', '%27Black%27'])
        assert 7 == self._sequence, 'Expected 9. Had: %s' % self._sequence

        # Change some variable
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
# Enable property tracing
        self.Write("124\t%s\t%s" % (self.NextSeq(), "true;false;false;true"))
        self.WriteStepIn(threadId)
        threadId, frameId, line = self.WaitForBreakpointHit('107', True)
        # Should go inside getter method
        assert line == 8, 'Expected return to be in line 8, was: %s' % line

        self.WriteRunThread(threadId)
        
        self.finishedOk = True

#=======================================================================================================================
# WriterThreadCase12
#======================================================================================================================
class WriterThreadCase12(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case10.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(2, '') #Should not be hit: setting empty function (not None) should only hit global.
        self.WriteAddBreakpoint(6, 'Method1a')  
        self.WriteAddBreakpoint(11, 'Method2') 
        self.WriteMakeInitialRun()
        
        threadId, frameId, line = self.WaitForBreakpointHit('111', True)
        
        assert line == 11, 'Expected return to be in line 11, was: %s' % line
        
        self.WriteStepReturn(threadId)
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId = self.WaitForNewThread()
        
        self.WriteSuspendThread(threadId)

        time.sleep(4) #wait for time enough for the test to finish if it wasn't suspended
        
        self.WriteRunThread(threadId)
        
        self.finishedOk = True


#=======================================================================================================================
# WriterThreadCase3
#=======================================================================================================================
class WriterThreadCase3(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case3.py')
        
    def run(self):
        self.StartSocket()
        self.WriteMakeInitialRun()
        time.sleep(1)
        self.WriteAddBreakpoint(4, '') 
        self.WriteAddBreakpoint(5, 'FuncNotAvailable') #Check that it doesn't get hit in the global when a function is available
        
        threadId, frameId = self.WaitForBreakpointHit()
        
        self.WriteGetFrame(threadId, frameId)
        
        self.WriteRunThread(threadId)
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId, frameId = self.WaitForBreakpointHit()
        
        self.WriteGetFrame(threadId, frameId)
        
        self.WriteRemoveBreakpoint(4)
        
        self.WriteRunThread(threadId)
        
        assert 17 == self._sequence, 'Expected 17. Had: %s' % self._sequence
        
        self.finishedOk = True

#=======================================================================================================================
# WriterThreadCase2
#=======================================================================================================================
class WriterThreadCase2(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case2.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(3, 'Call4') #seq = 3
        self.WriteMakeInitialRun()
        
        threadId, frameId = self.WaitForBreakpointHit()
        
        self.WriteGetFrame(threadId, frameId)
        
        self.WriteAddBreakpoint(14, 'Call2')
        
        self.WriteRunThread(threadId)
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
assert line == 15, 'Expected return to be in line 15, was: %s' % line
        
        self.WriteRunThread(threadId)

        assert 9 == self._sequence, 'Expected 9. Had: %s' % self._sequence
        
        self.finishedOk = True
        



#=======================================================================================================================
# WriterThreadCase7
#======================================================================================================================
class WriterThreadCase7(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case7.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(2, 'Call') 
        self.WriteMakeInitialRun()
        
        threadId, frameId = self.WaitForBreakpointHit('111')
        
        self.WriteGetFrame(threadId, frameId)
        
        self.WaitForVars('') #no vars at this point
        
        self.WriteStepOver(threadId)
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId, frameId, line = self.WaitForBreakpointHit('107', True)
        
        #goes to line 4 in jython (function declaration line)
        assert line in (4, 5), 'Expecting it to go to line 4 or 5. Went to: %s' % line
        
        self.WriteRunThread(threadId)

        assert 13 == self._sequence, 'Expected 15. Had: %s' % self._sequence
        
        self.finishedOk = True

#=======================================================================================================================
# WriterThreadCase5
#=======================================================================================================================
class WriterThreadCase5(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case56.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(2, 'Call2') 
        self.WriteMakeInitialRun()
        
        threadId, frameId = self.WaitForBreakpointHit()
        
        self.WriteGetFrame(threadId, frameId)
        
        self.WriteRemoveBreakpoint(2)
        
        self.WriteStepReturn(threadId)
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
# Iterate some loop
        self.WriteDebugConsoleExpression("%s\t%s\tEVALUATE\tfor i in range(3):"%(threadId, frameId))
        self.WaitForVars('True')
        self.WriteDebugConsoleExpression("%s\t%s\tEVALUATE\t    print i"%(threadId, frameId))
        self.WriteDebugConsoleExpression("%s\t%s\tEVALUATE\t"%(threadId, frameId))
        self.WaitForVars('False<output></output><output></output><output></output>')
        assert 17 == self._sequence, 'Expected 19. Had: %s' % self._sequence
        
        self.WriteRunThread(threadId)
        self.finishedOk = True


#=======================================================================================================================
# WriterThreadCase13
#======================================================================================================================
class WriterThreadCase13(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case13.py')
    
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(35, 'main')
        self.Write("124\t%s\t%s" % (self.NextSeq(), "true;false;false;true"))
        self.WriteMakeInitialRun()
        threadId, frameId, line = self.WaitForBreakpointHit('111', True)

        self.WriteGetFrame(threadId, frameId)
        
        self.WriteStepIn(threadId)
        threadId, frameId, line = self.WaitForBreakpointHit('107', True)
        # Should go inside setter method
        assert line == 25, 'Expected return to be in line 25, was: %s' % line
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId, frameId, line = self.WaitForBreakpointHit('107', True)
        
        #goes to line 4 in jython (function declaration line)
        assert line in (4, 5), 'Expecting it to go to line 4 or 5. Went to: %s' % line
        
        self.WriteRunThread(threadId)

        assert 15 == self._sequence, 'Expected 15. Had: %s' % self._sequence
        
        self.finishedOk = True


#=======================================================================================================================
# WriterThreadCase4
#=======================================================================================================================
class WriterThreadCase4(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case4.py')
        
    def run(self):
        self.StartSocket()
        self.WriteMakeInitialRun()
        
        threadId = self.WaitForNewThread()
        
        self.WriteSuspendThread(threadId)

        time.sleep(4) #wait for time enough for the test to finish if it wasn't suspended
        
        self.WriteRunThread(threadId)
        
        self.finishedOk = True
github deis / deis / pydevd / tests_python / test_debugger.py View on Github external
threadId, frameId, line = self.WaitForBreakpointHit('108', True)
        
        assert line == 12, 'Expected return to be in line 12, was: %s' % line
        
        self.WriteRunThread(threadId)

        assert 11 == self._sequence, 'Expected 11. Had: %s' % self._sequence
        
        self.finishedOk = True
        

#=======================================================================================================================
# WriterThreadCase8
#======================================================================================================================
class WriterThreadCase8(AbstractWriterThread):
    
    TEST_FILE = NormFile('_debugger_case89.py')
        
    def run(self):
        self.StartSocket()
        self.WriteAddBreakpoint(10, 'Method3') 
        self.WriteMakeInitialRun()
        
        threadId, frameId = self.WaitForBreakpointHit('111')
        
        self.WriteStepReturn(threadId)
        
        threadId, frameId, line = self.WaitForBreakpointHit('109', True)
        
        assert line == 15, 'Expected return to be in line 15, was: %s' % line