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

Function main

tests_python/resources/_debugger_case_pydevd_customization.py:5–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4
5def main():
6 env = os.environ.copy()
7 pythonpath = env.get('PYTHONPATH', '')
8 env['PYTHONPATH'] = os.path.dirname(__file__) + os.pathsep + \
9 os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
10
11 import pydevd
12 if '--use-dap-mode' in sys.argv:
13 pydevd.config('http_json', 'debugpy-dap')
14
15 from _pydev_bundle import pydev_log
16 pydev_log.debug('Argv received: %s', sys.argv)
17 port = int(sys.argv[1])
18 print('before pydevd.settrace')
19 pydevd.settrace(port=port, patch_multiprocessing=True, suspend=True)
20 print('after pydevd.settrace')
21
22 import subprocess
23 if '--use-c-switch' in sys.argv:
24 child_process = subprocess.Popen(
25 [sys.executable, '-u', '-c', 'import _debugger_case_pydevd_customization;_debugger_case_pydevd_customization.call()'],
26 stdout=subprocess.PIPE,
27 stderr=subprocess.PIPE,
28 env=env,
29 )
30 elif '--posix-spawn' in sys.argv:
31 env = os.environ.copy()
32 args = ['-u', '_debugger_case_pydevd_customization.py', '--simple-call']
33 pid = os.posix_spawn(sys.executable, args, env)
34 os.waitpid(pid, 0)
35 child_process = None # We don't really have a subprocess.Popen instance in this case.
36 else:
37 child_process = subprocess.Popen(
38 [sys.executable, '-u', '_debugger_case_pydevd_customization.py', '--simple-call'],
39 cwd=os.path.dirname(__file__),
40 stdout=subprocess.PIPE,
41 stderr=subprocess.PIPE,
42 env=env,
43 )
44
45 if child_process:
46 stdout, stderr = child_process.communicate()
47 assert b'called' in stdout, 'Did not find b"called" in stdout:\n>>%s<<\nstderr:\n>>%s<<\n' % (stdout, stderr)
48 print('TEST SUCEEDED!') # break 2 here
49
50
51def call():

Calls 2

copyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected