MCPcopy Index your code
hub / github.com/python/cpython / run_test

Function run_test

Lib/test/test_bdb.py:464–536  ·  view source on GitHub ↗

Run a test and print the dry-run results. 'modules': A dictionary mapping module names to their source code as a string. The dictionary MUST include one module named 'test_module' with a main() function. 'set_list': A list of set_type tuples to be run on the

(modules, set_list, skip=None)

Source from the content-addressed store, hash-verified

462 self.test_case.fail(not_empty)
463
464def run_test(modules, set_list, skip=None):
465 """Run a test and print the dry-run results.
466
467 'modules': A dictionary mapping module names to their source code as a
468 string. The dictionary MUST include one module named
469 'test_module' with a main() function.
470 'set_list': A list of set_type tuples to be run on the module.
471
472 For example, running the following script outputs the following results:
473
474 ***************************** SCRIPT ********************************
475
476 from test.test_bdb import run_test, break_in_func
477
478 code = '''
479 def func():
480 lno = 3
481
482 def main():
483 func()
484 lno = 7
485 '''
486
487 set_list = [
488 break_in_func('func', 'test_module.py'),
489 ('continue', ),
490 ('step', ),
491 ('step', ),
492 ('step', ),
493 ('quit', ),
494 ]
495
496 modules = { 'test_module': code }
497 run_test(modules, set_list)
498
499 **************************** results ********************************
500
501 1: ('line', 2, 'tfunc_import'), ('next',),
502 2: ('line', 3, 'tfunc_import'), ('step',),
503 3: ('call', 5, 'main'), ('break', ('test_module.py', None, False, None, 'func')),
504 4: ('None', 5, 'main'), ('continue',),
505 5: ('line', 3, 'func', ({1: 1}, [])), ('step',),
506 BpNum Temp Enb Hits Ignore Where
507 1 no yes 1 0 at test_module.py:2
508 6: ('return', 3, 'func'), ('step',),
509 7: ('line', 7, 'main'), ('step',),
510 8: ('return', 7, 'main'), ('quit',),
511
512 *************************************************************************
513
514 """
515 def gen(a, b):
516 try:
517 while 1:
518 x = next(a)
519 y = next(b)
520 yield x
521 yield y

Callers 1

test_anext_iterMethod · 0.70

Calls 8

listClass · 0.85
TracerRunClass · 0.85
BaseTestCaseClass · 0.70
genFunction · 0.70
create_modulesFunction · 0.70
repeatFunction · 0.50
extendMethod · 0.45
runcallMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…