mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
This commit is contained in:
parent
4f0659a4b5
commit
fd2aea41f3
3 changed files with 43 additions and 2 deletions
|
|
@ -118,7 +118,10 @@ class EventLoop(object):
|
|||
# thread, so, just silence it.
|
||||
pass
|
||||
else:
|
||||
traceback.print_exc()
|
||||
try:
|
||||
traceback.print_exc()
|
||||
except:
|
||||
pass # Could give an error during shutdown.
|
||||
|
||||
def stop(self):
|
||||
self._stop = True
|
||||
|
|
@ -173,4 +176,5 @@ def wrap_async(f):
|
|||
|
||||
callback(None)
|
||||
return result
|
||||
|
||||
return g
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import _pydevd_bundle.pydevd_comm_constants as pydevd_comm_constants # noqa
|
|||
import _pydevd_bundle.pydevd_extension_api as pydevd_extapi # noqa
|
||||
import _pydevd_bundle.pydevd_extension_utils as pydevd_extutil # noqa
|
||||
import _pydevd_bundle.pydevd_frame as pydevd_frame # noqa
|
||||
from pydevd_file_utils import get_abs_path_real_path_and_base_from_file # noqa
|
||||
# from _pydevd_bundle.pydevd_comm import pydevd_log
|
||||
from _pydevd_bundle.pydevd_dont_trace_files import PYDEV_FILE # noqa
|
||||
from _pydevd_bundle import pydevd_additional_thread_info
|
||||
|
|
@ -151,7 +152,7 @@ SafeReprPresentationProvider._instance = SafeReprPresentationProvider()
|
|||
str_handlers = pydevd_extutil.EXTENSION_MANAGER_INSTANCE.type_to_instance.setdefault(pydevd_extapi.StrPresentationProvider, []) # noqa
|
||||
str_handlers.insert(0, SafeReprPresentationProvider._instance)
|
||||
|
||||
PTVSD_DIR_PATH = os.path.dirname(os.path.abspath(__file__)) + os.path.sep
|
||||
PTVSD_DIR_PATH = os.path.dirname(os.path.abspath(get_abs_path_real_path_and_base_from_file(__file__)[0])) + os.path.sep
|
||||
NORM_PTVSD_DIR_PATH = os.path.normcase(PTVSD_DIR_PATH)
|
||||
|
||||
|
||||
|
|
|
|||
36
tests/func/test_stop_on_entry.py
Normal file
36
tests/func/test_stop_on_entry.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import print_function, with_statement, absolute_import
|
||||
|
||||
from tests.helpers.pattern import Path
|
||||
from tests.helpers.session import DebugSession
|
||||
from tests.helpers.timeline import Event
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('start_method', ['launch'])
|
||||
def test_stop_on_entry(run_as, start_method, tmpdir):
|
||||
testfile = tmpdir.join('test.py')
|
||||
with testfile.open('w') as stream:
|
||||
stream.write('''
|
||||
stop_here = 1
|
||||
print('done')
|
||||
''')
|
||||
|
||||
with DebugSession() as session:
|
||||
session.initialize(
|
||||
target=(run_as, str(testfile)),
|
||||
start_method=start_method,
|
||||
ignore_unobserved=[Event('continued')],
|
||||
debug_options=['StopOnEntry'],
|
||||
)
|
||||
|
||||
session.start_debugging()
|
||||
hit = session.wait_for_thread_stopped()
|
||||
frames = hit.stacktrace.body['stackFrames']
|
||||
assert frames[0]['source']['path'] == Path(str(testfile))
|
||||
|
||||
session.send_request('continue').wait_for_response(freeze=False)
|
||||
session.wait_for_exit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue