Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Add unhandled exception tests (#682)
Browse files Browse the repository at this point in the history
Adds unhandled exception tests #654
Fixes a bug in _io.py that caused JSONDecodeError in tests sometimes #683
Fixes a issue for some cases where the tests were timing out on windows
  • Loading branch information
karthiknadig authored Jul 23, 2018
1 parent 501d163 commit 5db5b30
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 31 deletions.
4 changes: 3 additions & 1 deletion ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ class InternalsFilter(object):
"""Identifies debugger internal artifacts.
"""
# TODO: Move the internal thread identifier here

def __init__(self):
if platform.system() == 'Windows':
self._init_windows()
Expand Down Expand Up @@ -1407,6 +1408,7 @@ def _apply_code_stepping_settings(self):
'\t'.join(project_dirs))

def _is_stdlib(self, filepath):
filepath = os.path.normcase(os.path.normpath(filepath))
for prefix in STDLIB_PATH_PREFIXES:
if prefix != '' and filepath.startswith(prefix):
return True
Expand Down Expand Up @@ -2090,7 +2092,7 @@ def on_setBreakpoints(self, request, args):
condition = None
expressions = re.findall('\{.*?\}', logMessage)
if len(expressions) == 0:
expression = '{}'.format(repr(logMessage)) # noqa
expression = '{}'.format(repr(logMessage)) # noqa
else:
raw_text = reduce(lambda a, b: a.replace(b, '{}'), expressions, logMessage) # noqa
raw_text = raw_text.replace('"', '\\"')
Expand Down
3 changes: 3 additions & 0 deletions tests/helpers/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def iter_lines_buffered(read, sep=b'\n', initial=b'', stop=noop):
data = read(1024)
if not data:
raise EOFError()
if buf and buf[-1:] == b'\r':
data = buf + data
buf = b''
except EOFError as exc:
exc.remainder = buf
raise
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ptvsd
import sys
ptvsd.enable_attach((sys.argv[1], sys.argv[2]))
ptvsd.wait_for_attach()

raise ArithmeticError('Hello')
sys.stdout.write('end')
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import sys

raise ArithmeticError('Hello')
sys.stdout.write('end')
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
import ptvsd
ptvsd.enable_attach((('localhost', 9879)))
ptvsd.wait_for_attach()

raise ArithmeticError('Hello')
sys.stdout.write('end')
Loading

0 comments on commit 5db5b30

Please sign in to comment.