def test_extra_sys_argv(self): filename = 'spam.py' port = 8888 debug_id = 1 debug_options = {'x': 'y'} sys.argv = [filename, '--abc', 'xyz', '42'] debug(filename, port, debug_id, debug_options, 'script', _run=self._run, _prog='eggs') self.assertEqual( self.argv, _get_args('--file', 'spam.py', '--abc', 'xyz', '42', ptvsd_extras=['--client', LOCALHOST])) self.assertEqual(self.addr, Address.as_client(None, port)) self.assertEqual(self.kwargs, { 'singlesession': True, })
def test_extra_sys_argv(self, setUp): filename = 'spam.py' _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} extra = ['--eggs', 'abc'] debug(filename, port, debug_id, debug_options, 'script', _runners=self.runners, _extra=extra) assert self.args == (addr, filename, '--eggs', 'abc') assert self.kwargs == {'singlesession': True}
def test_unsupported(self, setUp): filename = 'spam' _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, '???', _runners=self.runners, _extra=()) assert self.kind is None assert self.args == (addr, filename) assert self.kwargs == {'singlesession': True}
def test_code(self, setUp): filename = "print('spam')" _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, 'code', _runners=self.runners, _extra=()) assert self.kind == 'code' assert self.args == (addr, filename) assert self.kwargs == {'singlesession': True}
def test_script(self, setUp): filename = 'spam.py' _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, 'script', _runners=self.runners, _extra=()) assert self.kind == 'script' assert self.args == (addr, filename) assert self.kwargs == {'singlesession': True}
def test_unsupported(self, setUp): filename = 'spam' port = 8888 debug_id = 1 debug_options = {'x': 'y'} sys.argv = [filename] debug(filename, port, debug_id, debug_options, '???', _run=self._run, _prog='eggs') assert self.argv == _get_args('--file', 'spam', ptvsd_extras=['--client', LOCALHOST]) assert self.addr == Address.as_client(None, port) assert self.kwargs == {'singlesession': True}
def test_unsupported(self): filename = 'spam' _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, '???', _runners=self.runners, _extra=()) self.assertIs(self.kind, None) self.assertEqual(self.args, (addr, filename)) self.assertEqual(self.kwargs, { 'singlesession': True, })
def test_code(self): filename = "print('spam')" _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, 'code', _runners=self.runners, _extra=()) self.assertEqual(self.kind, 'code') self.assertEqual(self.args, (addr, filename)) self.assertEqual(self.kwargs, { 'singlesession': True, })
def test_script(self): filename = 'spam.py' _, port = addr = (LOCALHOST, 8888) debug_id = 1 debug_options = {'x': 'y'} debug(filename, port, debug_id, debug_options, 'script', _runners=self.runners, _extra=()) self.assertEqual(self.kind, 'script') self.assertEqual(self.args, (addr, filename)) self.assertEqual(self.kwargs, { 'singlesession': True, })
def test_code(self): filename = "print('spam')" port = 8888 debug_id = 1 debug_options = {'x': 'y'} sys.argv = [filename] debug(filename, port, debug_id, debug_options, 'code', _run=self._run, _prog='eggs') self.assertEqual( self.argv, _get_args('--file', filename, ptvsd_extras=['--client', LOCALHOST])) self.assertEqual(self.addr, Address.as_client(None, port)) self.assertEqual(self.kwargs, { 'singlesession': True, })
import ptvsd.debugger as vspd ptvsd_loaded = True except ImportError: ptvsd_loaded = False raise vspd.DONT_DEBUG.append(os.path.normcase(__file__)) except: traceback.print_exc() if not bundled_ptvsd and not ptvsd_loaded: # This is experimental debugger import error. Exit immediately. # This process will be killed by VS since it does not see a debugger # connect to it. The exit code we will get there will be wrong. # 126 : ERROR_MOD_NOT_FOUND sys.exit(126) print(''' Internal error detected. Please copy the above traceback and report at https://go.microsoft.com/fwlink/?LinkId=293415 Press Enter to close. . .''') try: raw_input() except NameError: input() sys.exit(1) finally: if ptvs_lib_path: sys.path.remove(ptvs_lib_path) # and start debugging vspd.debug(filename, port_num, debug_id, debug_options, run_as)
ptvsd_loaded = False raise vspd.DONT_DEBUG.append(os.path.normcase(__file__)) except: traceback.print_exc() if not bundled_ptvsd and not ptvsd_loaded: # This is experimental debugger import error. Exit immediately. # This process will be killed by VS since it does not see a debugger # connect to it. The exit code we will get there will be wrong. # 126 : ERROR_MOD_NOT_FOUND sys.exit(126) print(''' Internal error detected. Please copy the above traceback and report at https://github.com/Microsoft/vscode-python/issues/new Press Enter to close. . .''') try: raw_input() except NameError: input() sys.exit(1) finally: if ptvs_lib_path: sys.path.remove(ptvs_lib_path) if no_debug: vspd.run(filename, port_num, run_as, *sys.argv[1:]) else: # and start debugging vspd.debug(filename, port_num, '', '', run_as)