Fixes some bugs with just-my-code (#727)

* Continue if the suspended in debugger code

* Get more info via exception description

* More logging

* Add a check for site-packages

* Remove debug logs and cleanup

* Fix tests

* Fix more test bugs

* more cleanup
This commit is contained in:
Karthik Nadig 2018-08-01 19:40:34 -07:00 committed by GitHub
parent f726968304
commit 522e9f1ce4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View file

@ -1397,13 +1397,13 @@ class VSCodeMessageProcessor(VSCLifecycleMsgProcessor):
vendored_pydevd = os.path.sep + \
os.path.join('ptvsd', '_vendored', 'pydevd')
ptvsd_path = os.path.sep + 'ptvsd'
site_path = os.path.sep + 'site-packages'
project_dirs = []
for path in sys.path + [os.getcwd()]:
is_stdlib = False
norm_path = os.path.normcase(path)
if path.endswith(ptvsd_path) or \
path.endswith(vendored_pydevd):
if path.endswith((ptvsd_path, vendored_pydevd, site_path)):
is_stdlib = True
else:
for prefix in STDLIB_PATH_PREFIXES:
@ -2301,7 +2301,8 @@ class VSCodeMessageProcessor(VSCLifecycleMsgProcessor):
xframe = xframes[0]
filepath = unquote(xframe['file'])
if reason in STEP_REASONS or reason in EXCEPTION_REASONS:
if not self._should_debug(filepath):
if self.internals_filter.is_internal_path(filepath) or \
not self._should_debug(filepath):
self.pydevd_notify(pydevd_comm.CMD_THREAD_RUN, pyd_tid)
return

View file

@ -908,7 +908,7 @@ class VSCTest(object):
expected = list(self.vsc.protocol.parse_each(expected))
self.assertEqual(received[:-1], expected)
failure = received[-1]
failure = received[-1] if len(received) > 0 else []
expected = self.vsc.protocol.parse(
self.fix.vsc_msgs.new_failure(req, failure.message))
self.assertEqual(failure, expected)

View file

@ -30,13 +30,13 @@ def _get_project_dirs():
vendored_pydevd = os.path.sep + \
os.path.join('ptvsd', '_vendored', 'pydevd')
ptvsd_path = os.path.sep + 'ptvsd'
site_path = os.path.sep + 'site-packages'
project_dirs = []
for path in sys.path + [os.getcwd()]:
is_stdlib = False
norm_path = os.path.normcase(path)
if path.endswith(ptvsd_path) or \
path.endswith(vendored_pydevd):
if path.endswith((ptvsd_path, vendored_pydevd, site_path)):
is_stdlib = True
else:
for prefix in ptvsd.wrapper.STDLIB_PATH_PREFIXES:

View file

@ -378,7 +378,7 @@ class FlaskLaunchFileTests(WebFrameworkTests):
'FLASK_ENV': 'development',
'FLASK_DEBUG': '0',
'LC_ALL': 'C.UTF-8',
'LANG': 'C.UTF-8'
'LANG': 'C.UTF-8',
},
cwd=cwd),
framework='Jinja',
@ -399,7 +399,7 @@ class FlaskLaunchFileTests(WebFrameworkTests):
'FLASK_ENV': 'development',
'FLASK_DEBUG': '0',
'LC_ALL': 'C.UTF-8',
'LANG': 'C.UTF-8'
'LANG': 'C.UTF-8',
},
cwd=cwd),
framework='Jinja',
@ -418,7 +418,7 @@ class FlaskLaunchFileTests(WebFrameworkTests):
'FLASK_ENV': 'development',
'FLASK_DEBUG': '0',
'LC_ALL': 'C.UTF-8',
'LANG': 'C.UTF-8'
'LANG': 'C.UTF-8',
},
cwd=cwd), 'Jinja', filename)
@ -434,7 +434,7 @@ class FlaskLaunchFileTests(WebFrameworkTests):
'FLASK_ENV': 'development',
'FLASK_DEBUG': '0',
'LC_ALL': 'C.UTF-8',
'LANG': 'C.UTF-8'
'LANG': 'C.UTF-8',
},
cwd=cwd), 'Jinja', filename)