This commit is contained in:
Pavel Minaev 2019-10-30 14:35:38 -07:00 коммит произвёл Pavel Minaev
Родитель fad3c4f878
Коммит c910565b9a
5 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -8,6 +8,7 @@ build-backend = "setuptools.build_meta"
# The only exclusions that should remain in the end are _vendored and versioneer.
exclude = '''
( __pycache__
| ^/.tox
| ^/versioneer.py
| ^/src/ptvsd/_vendored
| ^/src/ptvsd/_version.py

Просмотреть файл

@ -40,7 +40,7 @@ def main(args):
if args.for_enable_attach:
endpoints = {
"ide": {"host": ide_host, "port": ide_port},
"server": {"host": server_host, "port": server_port}
"server": {"host": server_host, "port": server_port},
}
log.info("Sending endpoints to stdout: {0!r}", endpoints)
print(json.dumps(endpoints))
@ -76,9 +76,7 @@ def _parse_argv(argv):
)
parser.add_argument(
"--for-enable-attach",
action="store_true",
help=argparse.SUPPRESS,
"--for-enable-attach", action="store_true", help=argparse.SUPPRESS
)
parser.add_argument(

Просмотреть файл

@ -81,6 +81,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns):
raise RuntimeError("enable_attach() can only be called once per process.")
import subprocess
adapter_args = [
sys.executable,
_ADAPTER_PATH,
@ -98,11 +99,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns):
# Adapter life time is expected to be longer than this process,
# so never wait on the adapter process
process = subprocess.Popen(
adapter_args,
bufsize=0,
stdout=subprocess.PIPE,
)
process = subprocess.Popen(adapter_args, bufsize=0, stdout=subprocess.PIPE)
line = process.stdout.readline()
if isinstance(line, bytes):
@ -110,7 +107,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns):
connection_details = json.JSONDecoder().decode(line)
log.info("Connection details received from adapter: {0!r}", connection_details)
host = "127.0.0.1" # This should always be loopback address.
host = "127.0.0.1" # This should always be loopback address.
port = connection_details["server"]["port"]
pydevd.settrace(
@ -128,7 +125,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns):
# Ensure that we ignore the adapter process when terminating the debugger.
pydevd.add_dont_terminate_child_pid(process.pid)
server_opts.port = connection_details["ide"]["port"]
server_opts.port = connection_details["ide"]["port"]
listener_file = os.getenv("PTVSD_LISTENER_FILE")
if listener_file is not None:

Просмотреть файл

@ -101,7 +101,6 @@ def test_conditional_breakpoint(pyfile, target, run, condition_kind, condition):
def test_crossfile_breakpoint(pyfile, target, run):
@pyfile
def script1():
import debug_me # noqa
@ -171,7 +170,6 @@ def test_error_in_condition(pyfile, target, run, error_name):
@pytest.mark.parametrize("condition", ["condition", ""])
def test_log_point(pyfile, target, run, condition):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -247,7 +245,6 @@ def test_package_launch(run):
def test_add_and_remove_breakpoint(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -279,7 +276,6 @@ def test_add_and_remove_breakpoint(pyfile, target, run):
def test_breakpoint_in_nonexistent_file(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -300,7 +296,6 @@ def test_breakpoint_in_nonexistent_file(pyfile, target, run):
def test_invalid_breakpoints(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -368,7 +363,6 @@ def test_invalid_breakpoints(pyfile, target, run):
def test_deep_stacks(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa

Просмотреть файл

@ -15,7 +15,6 @@ from tests import debug
def test_with_no_output(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -36,7 +35,6 @@ def test_with_no_output(pyfile, target, run):
def test_with_tab_in_output(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -57,7 +55,6 @@ def test_with_tab_in_output(pyfile, target, run):
@pytest.mark.parametrize("redirect", ["enabled", "disabled"])
def test_redirect_output(pyfile, target, run, redirect):
@pyfile
def code_to_debug():
import debug_me # noqa
@ -83,12 +80,12 @@ def test_redirect_output(pyfile, target, run, redirect):
def test_non_ascii_output(pyfile, target, run):
@pyfile
def code_to_debug():
import debug_me # noqa
import sys
a = b'\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n'
a = b"\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n"
if sys.version_info[0] >= 3:
sys.stdout.buffer.write(a)
else:
@ -104,10 +101,9 @@ def test_non_ascii_output(pyfile, target, run):
session.wait_for_stop()
session.request_continue()
output = session.output("stdout").encode('utf-8', 'replace')
output = session.output("stdout").encode("utf-8", "replace")
assert output in (
b'\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n',
b'\xc3\x83\xc2\xa9 \xc3\x83\xc2\xa0 \xc3\x83\xc2\xb6 \xc3\x83\xc2\xb9\n'
b"\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n",
b"\xc3\x83\xc2\xa9 \xc3\x83\xc2\xa0 \xc3\x83\xc2\xb6 \xc3\x83\xc2\xb9\n",
)