This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subprocesses should inherit PydevdCustomization. Fixes #1874
- Loading branch information
Showing
9 changed files
with
212 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/ptvsd/_vendored/pydevd/tests_python/resources/_debugger_case_pydevd_customization.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import sys | ||
import os | ||
|
||
|
||
def main(): | ||
env = os.environ.copy() | ||
pythonpath = env.get('PYTHONPATH', '') | ||
env['PYTHONPATH'] = os.path.dirname(__file__) + os.pathsep + \ | ||
os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | ||
|
||
from _pydevd_bundle.pydevd_constants import HTTP_JSON_PROTOCOL | ||
from _pydevd_bundle.pydevd_defaults import PydevdCustomization | ||
PydevdCustomization.DEFAULT_PROTOCOL = HTTP_JSON_PROTOCOL | ||
|
||
import pydevd | ||
from _pydev_bundle import pydev_log | ||
pydev_log.debug('Argv received: %s', sys.argv) | ||
port = int(sys.argv[1]) | ||
print('before pydevd.settrace') | ||
pydevd.settrace(port=port, patch_multiprocessing=True, suspend=True) | ||
print('after pydevd.settrace') | ||
|
||
import subprocess | ||
if '--use-c-switch' in sys.argv: | ||
p = subprocess.Popen( | ||
[sys.executable, '-u', '-c', 'import _debugger_case_pydevd_customization;_debugger_case_pydevd_customization.call()'], | ||
stdout=subprocess.PIPE, | ||
env=env, | ||
) | ||
else: | ||
p = subprocess.Popen( | ||
[sys.executable, '-u', '_debugger_case_pydevd_customization.py', '--simple-call'], | ||
cwd=os.path.dirname(__file__), | ||
stdout=subprocess.PIPE, | ||
env=env, | ||
) | ||
|
||
stdout, stderr = p.communicate() | ||
assert b'called' in stdout, 'Did not find b"called" in: %s' % (stdout,) | ||
print('TEST SUCEEDED!') # break 2 here | ||
|
||
|
||
def call(): | ||
print("called") # break 1 here | ||
|
||
|
||
if __name__ == '__main__': | ||
if '--simple-call' in sys.argv: | ||
call() | ||
else: | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters