From 87ea74ef809dcf29055abf785848367971c30ba7 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Fri, 27 Sep 2019 12:39:12 -0700 Subject: [PATCH] Refactor test_tracing to use the new test API. --- tests/ptvsd/server/test_tracing.py | 47 ++++++++++-------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/tests/ptvsd/server/test_tracing.py b/tests/ptvsd/server/test_tracing.py index 49a4ca58..b911d746 100644 --- a/tests/ptvsd/server/test_tracing.py +++ b/tests/ptvsd/server/test_tracing.py @@ -8,12 +8,10 @@ from tests import debug from tests.patterns import some -def test_tracing(pyfile, start_method, run_as): - +def test_tracing(pyfile, target, run): @pyfile def code_to_debug(): import debug_me # noqa - import ptvsd def func(expected_tracing): @@ -51,39 +49,26 @@ def test_tracing(pyfile, start_method, run_as): print(0) # @outer2 func(True) - with debug.Session(start_method, client_id='vscode') as session: - session.configure(run_as, code_to_debug) - session.set_breakpoints(code_to_debug, all) - session.start_debugging() - - stop = session.wait_for_stop() - frame = stop.frames[0] - assert frame == some.dict.containing({ - "line": code_to_debug.lines["inner2"], - }) + with debug.Session() as session: + with run(session, target(code_to_debug)): + session.set_breakpoints(code_to_debug, all) + session.wait_for_stop( + expected_frames=[some.dap.frame(code_to_debug, "inner2")] + ) session.request_continue() - stop = session.wait_for_stop() - frame = stop.frames[0] - assert frame == some.dict.containing({ - "line": code_to_debug.lines["outer2"], - }) - + session.wait_for_stop( + expected_frames=[some.dap.frame(code_to_debug, "outer2")] + ) session.request_continue() - stop = session.wait_for_stop() - frame = stop.frames[0] - assert frame == some.dict.containing({ - "line": code_to_debug.lines["inner1"], - }) - + session.wait_for_stop( + expected_frames=[some.dap.frame(code_to_debug, "inner1")] + ) session.request_continue() - stop = session.wait_for_stop() - frame = stop.frames[0] - assert frame == some.dict.containing({ - "line": code_to_debug.lines["inner3"], - }) - + session.wait_for_stop( + expected_frames=[some.dap.frame(code_to_debug, "inner3")] + ) session.request_continue()