MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_run

Function test_run

tests_python/test_run.py:26–99  ·  view source on GitHub ↗
(testdir_or_pytester)

Source from the content-addressed store, hash-verified

24
25
26def 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 """
41import sys
42sys.path.append(%(pydevd_dir)r)
43import pydevd
44py_db = pydevd.PyDB()
45py_db.ready_to_run = True
46py_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 """
56import sys
57sys.path.append(%(pydevd_dir)r)
58import pydevd
59py_db = pydevd.PyDB()
60py_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 """
74import sys
75sys.path.append(%(pydevd_dir)r)
76sys.argv.append('--as-module')
77import pydevd
78py_db = pydevd.PyDB()
79py_db.ready_to_run = True
80py_db.run(%(foo_module)r, is_module=True)
81"""
82 % locals()
83 ),

Callers

nothing calls this directly

Calls 2

_run_and_checkFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected