mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Refactor test_tracing to use the new test API.
This commit is contained in:
parent
b4cbae7611
commit
87ea74ef80
1 changed files with 16 additions and 31 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue