628 # set the system exception handling function to ensure, that |
628 # set the system exception handling function to ensure, that |
629 # we report on all unhandled exceptions |
629 # we report on all unhandled exceptions |
630 sys.excepthook = self.__unhandled_exception |
630 sys.excepthook = self.__unhandled_exception |
631 |
631 |
632 # generate a coverage object |
632 # generate a coverage object |
633 self.cover = coverage(auto_data=True, |
633 self.cover = coverage( |
|
634 auto_data=True, |
634 data_file="{0}.coverage".format( |
635 data_file="{0}.coverage".format( |
635 os.path.splitext(sys.argv[0])[0])) |
636 os.path.splitext(sys.argv[0])[0])) |
636 self.cover.use_cache(True) |
637 self.cover.use_cache(True) |
637 |
638 |
638 if int(erase): |
639 if int(erase): |
821 |
822 |
822 return |
823 return |
823 |
824 |
824 if cmd == DebugProtocol.RequestBanner: |
825 if cmd == DebugProtocol.RequestBanner: |
825 self.write('{0}{1}\n'.format(DebugProtocol.ResponseBanner, |
826 self.write('{0}{1}\n'.format(DebugProtocol.ResponseBanner, |
826 str(("Python {0}".format(sys.version), |
827 str(("Python {0}".format(sys.version), |
827 socket.gethostname(), self.variant)))) |
828 socket.gethostname(), self.variant)))) |
828 return |
829 return |
829 |
830 |
830 if cmd == DebugProtocol.RequestCapabilities: |
831 if cmd == DebugProtocol.RequestCapabilities: |
831 self.write('{0}{1:d}, "Python3"\n'.format( |
832 self.write('{0}{1:d}, "Python3"\n'.format( |
832 DebugProtocol.ResponseCapabilities, |
833 DebugProtocol.ResponseCapabilities, |
874 return |
875 return |
875 |
876 |
876 # generate a coverage object |
877 # generate a coverage object |
877 if int(cov): |
878 if int(cov): |
878 from coverage import coverage |
879 from coverage import coverage |
879 self.cover = coverage(auto_data=True, |
880 self.cover = coverage( |
|
881 auto_data=True, |
880 data_file="{0}.coverage".format( |
882 data_file="{0}.coverage".format( |
881 os.path.splitext(covname)[0])) |
883 os.path.splitext(covname)[0])) |
882 self.cover.use_cache(True) |
884 self.cover.use_cache(True) |
883 if int(erase): |
885 if int(erase): |
884 self.cover.erase() |
886 self.cover.erase() |
885 else: |
887 else: |
886 self.cover = None |
888 self.cover = None |
887 |
889 |
888 self.write('{0}{1}\n'.format(DebugProtocol.ResponseUTPrepared, |
890 self.write('{0}{1}\n'.format( |
|
891 DebugProtocol.ResponseUTPrepared, |
889 str((self.test.countTestCases(), "", "")))) |
892 str((self.test.countTestCases(), "", "")))) |
890 return |
893 return |
891 |
894 |
892 if cmd == DebugProtocol.RequestUTRun: |
895 if cmd == DebugProtocol.RequestUTRun: |
893 from DCTestResult import DCTestResult |
896 from DCTestResult import DCTestResult |
1891 |
1894 |
1892 self.write("{0}{1}||{2}\n".format(DebugProtocol.ResponseCompletion, |
1895 self.write("{0}{1}||{2}\n".format(DebugProtocol.ResponseCompletion, |
1893 str(completions), text)) |
1896 str(completions), text)) |
1894 |
1897 |
1895 def startDebugger(self, filename=None, host=None, port=None, |
1898 def startDebugger(self, filename=None, host=None, port=None, |
1896 enableTrace=True, exceptions=True, tracePython=False, |
1899 enableTrace=True, exceptions=True, tracePython=False, |
1897 redirect=True): |
1900 redirect=True): |
1898 """ |
1901 """ |
1899 Public method used to start the remote debugger. |
1902 Public method used to start the remote debugger. |
1900 |
1903 |
1901 @param filename the program to be debugged (string) |
1904 @param filename the program to be debugged (string) |
1902 @param host hostname of the debug server (string) |
1905 @param host hostname of the debug server (string) |
1948 # now start debugging |
1951 # now start debugging |
1949 if enableTrace: |
1952 if enableTrace: |
1950 self.mainThread.set_trace() |
1953 self.mainThread.set_trace() |
1951 |
1954 |
1952 def startProgInDebugger(self, progargs, wd='', host=None, |
1955 def startProgInDebugger(self, progargs, wd='', host=None, |
1953 port=None, exceptions=True, tracePython=False, redirect=True): |
1956 port=None, exceptions=True, tracePython=False, |
|
1957 redirect=True): |
1954 """ |
1958 """ |
1955 Public method used to start the remote debugger. |
1959 Public method used to start the remote debugger. |
1956 |
1960 |
1957 @param progargs commandline for the program to be debugged |
1961 @param progargs commandline for the program to be debugged |
1958 (list of strings) |
1962 (list of strings) |