(testdir_or_pytester)
| 24 | |
| 25 | |
| 26 | def test_run(testdir_or_pytester): |
| 27 | from tests_python import debugger_unittest |
| 28 | import sys |
| 29 | import os |
| 30 | |
| 31 | foo_dir = debugger_unittest._get_debugger_test_file(os.path.join("resources", "launch", "foo")) |
| 32 | foo_module = "tests_python.resources.launch.foo" |
| 33 | |
| 34 | pydevd_dir = os.path.dirname(os.path.dirname(__file__)) |
| 35 | assert os.path.exists(os.path.join(pydevd_dir, "pydevd.py")) |
| 36 | |
| 37 | _run_and_check( |
| 38 | testdir_or_pytester, |
| 39 | testdir_or_pytester.makepyfile( |
| 40 | """ |
| 41 | import sys |
| 42 | sys.path.append(%(pydevd_dir)r) |
| 43 | import pydevd |
| 44 | py_db = pydevd.PyDB() |
| 45 | py_db.ready_to_run = True |
| 46 | py_db.run(%(foo_dir)r) |
| 47 | """ |
| 48 | % locals() |
| 49 | ), |
| 50 | ) |
| 51 | |
| 52 | _run_and_check( |
| 53 | testdir_or_pytester, |
| 54 | testdir_or_pytester.makepyfile( |
| 55 | """ |
| 56 | import sys |
| 57 | sys.path.append(%(pydevd_dir)r) |
| 58 | import pydevd |
| 59 | py_db = pydevd.PyDB() |
| 60 | py_db.run(%(foo_dir)r, set_trace=False) |
| 61 | """ |
| 62 | % locals() |
| 63 | ), |
| 64 | ) |
| 65 | |
| 66 | if sys.version_info[0:2] == (2, 6): |
| 67 | # Not valid for Python 2.6 |
| 68 | return |
| 69 | |
| 70 | _run_and_check( |
| 71 | testdir_or_pytester, |
| 72 | testdir_or_pytester.makepyfile( |
| 73 | """ |
| 74 | import sys |
| 75 | sys.path.append(%(pydevd_dir)r) |
| 76 | sys.argv.append('--as-module') |
| 77 | import pydevd |
| 78 | py_db = pydevd.PyDB() |
| 79 | py_db.ready_to_run = True |
| 80 | py_db.run(%(foo_module)r, is_module=True) |
| 81 | """ |
| 82 | % locals() |
| 83 | ), |
nothing calls this directly
no test coverage detected