mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] PY-84514 fix debugger import in isolated mode
there is already code to tweak `sys.path` to workaround the isolated mode, we just need to import all debugger stuff AFTER it (cherry picked from commit acc72ae1a88e4533243a43c30bda4ab3b62c3ec9) IJ-MR-179907 GitOrigin-RevId: af64cb82c3a79fbd133c303ddb0975f7b70a7f26
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8a926e04c6
commit
f0e35dfed4
@@ -8,14 +8,13 @@ import sys
|
||||
from contextlib import contextmanager
|
||||
import weakref
|
||||
|
||||
from _pydevd_bundle.pydevd_daemon_thread import run_as_pydevd_daemon_thread
|
||||
|
||||
# allow the debugger to work in isolated mode Python
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
if here not in sys.path:
|
||||
sys.path.insert(0, here)
|
||||
|
||||
from _pydevd_bundle.pydevd_collect_try_except_info import collect_return_info
|
||||
from _pydevd_bundle.pydevd_daemon_thread import run_as_pydevd_daemon_thread
|
||||
|
||||
if sys.version_info[:2] < (2, 6):
|
||||
raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
from _pydevd_bundle.pydevd_constants import IS_PY3K
|
||||
|
||||
if IS_PY3K:
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@pytest.mark.python3(reason="`-I` is introduced in 3.4")
|
||||
def test_isolated_mode():
|
||||
script = Path("pydevd.py")
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-I", str(script), "--help"],
|
||||
cwd=Path.cwd(),
|
||||
)
|
||||
|
||||
assert result.returncode == 0
|
||||
Reference in New Issue
Block a user