From a45040a4f99cf9e52b44aabc07d3dbd3dad2de27 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Tue, 21 Jan 2020 17:41:25 -0800 Subject: [PATCH] Fix test_argv_quoting --- tests/debugpy/test_multiproc.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/debugpy/test_multiproc.py b/tests/debugpy/test_multiproc.py index 064395e1..6d719910 100644 --- a/tests/debugpy/test_multiproc.py +++ b/tests/debugpy/test_multiproc.py @@ -247,8 +247,7 @@ def test_autokill(pyfile, target): child_session.wait_for_exit() -@pytest.mark.skip("Needs refactoring to use the new debug.Session API") -def test_argv_quoting(pyfile, start_method, run_as): +def test_argv_quoting(pyfile, target, run): @pyfile def args(): import debug_me # noqa @@ -289,15 +288,23 @@ def test_argv_quoting(pyfile, start_method, run_as): actual_args = sys.argv[1:] backchannel.send(actual_args) - with debug.Session(start_method, backchannel=True) as session: - backchannel = session.backchannel - session.configure(run_as, parent, args=[child]) + with debug.Session() as parent_session: + backchannel = parent_session.open_backchannel() - session.start_debugging() + with run(parent_session, target(parent, args=[child])): + pass - expected_args = backchannel.receive() - actual_args = backchannel.receive() - assert expected_args == actual_args + child_config = parent_session.wait_for_next_event("debugpyAttach") + parent_session.proceed() + + with debug.Session(child_config) as child_session: + with child_session.start(): + pass + + expected_args = backchannel.receive() + actual_args = backchannel.receive() + + assert expected_args == actual_args @pytest.mark.skip("Needs refactoring to use the new debug.Session API")