(pyfile, target, run)
| 344 | |
| 345 | |
| 346 | def test_argv_quoting(pyfile, target, run): |
| 347 | @pyfile |
| 348 | def args(): |
| 349 | args = [ # noqa |
| 350 | r"regular", |
| 351 | r"", |
| 352 | r"with spaces" r'"quoted"', |
| 353 | r'" quote at start', |
| 354 | r'quote at end "', |
| 355 | r'quote in " the middle', |
| 356 | r'quotes "in the" middle', |
| 357 | r"\path with\spaces", |
| 358 | r"\path\with\terminal\backslash" + "\\", |
| 359 | r"backslash \" before quote", |
| 360 | ] |
| 361 | |
| 362 | @pyfile |
| 363 | def parent(): |
| 364 | import debuggee |
| 365 | import sys |
| 366 | import subprocess |
| 367 | from args import args |
| 368 | |
| 369 | debuggee.setup() |
| 370 | child = sys.argv[1] |
| 371 | subprocess.check_call([sys.executable] + [child] + args) |
| 372 | |
| 373 | @pyfile |
| 374 | def child(): |
| 375 | import sys |
| 376 | from debuggee import backchannel |
| 377 | from args import args as expected_args |
| 378 | |
| 379 | backchannel.send(expected_args) |
| 380 | |
| 381 | actual_args = sys.argv[1:] |
| 382 | backchannel.send(actual_args) |
| 383 | |
| 384 | with debug.Session() as parent_session: |
| 385 | backchannel = parent_session.open_backchannel() |
| 386 | |
| 387 | with run(parent_session, target(parent, args=[child])): |
| 388 | pass |
| 389 | |
| 390 | child_config = parent_session.wait_for_next_event("debugpyAttach") |
| 391 | parent_session.proceed() |
| 392 | |
| 393 | with debug.Session(child_config) as child_session: |
| 394 | with child_session.start(): |
| 395 | pass |
| 396 | |
| 397 | expected_args = backchannel.receive() |
| 398 | actual_args = backchannel.receive() |
| 399 | |
| 400 | assert expected_args == actual_args |
| 401 | |
| 402 | |
| 403 | def test_echo_and_shell(pyfile, target, run): |
nothing calls this directly
no test coverage detected
searching dependent graphs…