Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get tox working with pytest --pdbcls=IPython.terminal.debugger:TerminalPdb #2936

Closed
stanislav-zaprudskiy opened this issue Mar 10, 2023 · 4 comments
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@stanislav-zaprudskiy
Copy link

Issue

When using tox with pytest --pdbcls=IPython.terminal.debugger:TerminalPdb all output in a debug session disappears immediately after showing up, making REPL not usable. It works fine when using tox with the standard pdb, and works fine without tox with just pytest directly.

asciicast

Environment

  • OS: macOS 13.2.1, iTerm 3.4.19, tmux 3.2a, bash 5.1.12(1)-release (x86_64-apple-darwin20.6.0)

  • `pip list` of the host Python where `tox` is installed:
    $ pipx runpip tox freeze
    cachetools==5.3.0
    chardet==5.1.0
    colorama==0.4.6
    distlib==0.3.6
    filelock==3.9.0
    packaging==23.0
    platformdirs==3.0.0
    pluggy==1.0.0
    pyproject_api==1.5.0
    tox==4.4.6
    virtualenv==20.20.0

Output of running tox

Provide the output of `tox -rvv`:
py310: 695 W remove tox env folder /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310 [tox/tox_env/api.py:322]
py310: 2693 I find interpreter for spec PythonSpec(major=3, minor=10) [virtualenv/discovery/builtin.py:56]
py310: 2695 D got python info of /usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11 from /Users/sz/Library/Application Support/virtualenv/py_info/1/e8161cb82d7b55ccc5b19c5ce3595fd4b239d7c1873be9f0166c26b9f15d08a6.json [virtualenv/app_data/via_disk_folder.py:129]
py310: 2697 D got python info of /usr/local/opt/python@3.11/bin/python3.11 from /Users/sz/Library/Application Support/virtualenv/py_info/1/2d4e9b9c84dab3e1662173f95b81bd7f8a551068d04f5f3c42d164db7312a928.json [virtualenv/app_data/via_disk_folder.py:129]
py310: 2697 I proposed PythonInfo(spec=CPython3.11.2.final.0-64, system=/usr/local/opt/python@3.11/bin/python3.11, exe=/Users/sz/.local/pipx/venvs/tox/bin/python, platform=darwin, version='3.11.2 (main, Feb 16 2023, 03:07:35) [Clang 14.0.0 (clang-1400.0.29.202)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63]
py310: 2698 D discover PATH[0]=/usr/local/Cellar/pyenv/2.3.14/libexec [virtualenv/discovery/builtin.py:108]
py310: 2698 D discover PATH[1]=/usr/local/Cellar/pyenv/2.3.14/plugins/python-build/bin [virtualenv/discovery/builtin.py:108]
py310: 2698 D discover PATH[2]=/Users/sz/.pyenv/shims [virtualenv/discovery/builtin.py:108]
py310: 2700 D got python info of /Users/sz/.pyenv/shims/python3.10 from /Users/sz/Library/Application Support/virtualenv/py_info/1/60e123c08527dbb99f2ed9474e4bf3d4757b29c2eaa32222aacfc1996b4d5eac.json [virtualenv/app_data/via_disk_folder.py:129]
py310: 2702 D got python info of /usr/local/opt/python@3.10/bin/python3.10 from /Users/sz/Library/Application Support/virtualenv/py_info/1/8f9328efe3468e6c370cdfed98702d3986faf748314d5bcec59da615d65baa7a.json [virtualenv/app_data/via_disk_folder.py:129]
py310: 2703 I proposed PathPythonInfo(spec=CPython3.10.10.final.0-64, system=/usr/local/opt/python@3.10/bin/python3.10, exe=/Users/sz/.pyenv/shims/python3.10, platform=darwin, version='3.10.10 (main, Feb 16 2023, 02:55:02) [Clang 14.0.0 (clang-1400.0.29.202)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63]
py310: 2703 D accepted PathPythonInfo(spec=CPython3.10.10.final.0-64, system=/usr/local/opt/python@3.10/bin/python3.10, exe=/Users/sz/.pyenv/shims/python3.10, platform=darwin, version='3.10.10 (main, Feb 16 2023, 02:55:02) [Clang 14.0.0 (clang-1400.0.29.202)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
py310: 2709 D filesystem is not case-sensitive [virtualenv/info.py:24]
py310: 2798 I create virtual environment via CPython3Posix(dest=/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:48]
py310: 2799 D create folder /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/bin [virtualenv/util/path/_sync.py:9]
py310: 2799 D create folder /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages [virtualenv/util/path/_sync.py:9]
py310: 2800 D write /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30]
py310: 2800 D 	home = /usr/local/opt/python@3.10/bin [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	version_info = 3.10.10.final.0 [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	virtualenv = 20.20.0 [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	base-prefix = /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	base-exec-prefix = /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D 	base-executable = /usr/local/opt/python@3.10/bin/python3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 2800 D symlink /usr/local/opt/python@3.10/bin/python3.10 to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/bin/python [virtualenv/util/path/_sync.py:28]
py310: 2802 D create virtualenv import hook file /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:89]
py310: 2803 D create /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:92]
py310: 2804 D ============================== target debug ============================== [virtualenv/run/session.py:50]
py310: 2804 D debug via /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/bin/python /Users/sz/.local/pipx/venvs/tox/lib/python3.11/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:193]
py310: 2804 D {
  "sys": {
    "executable": "/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/bin/python",
    "_base_executable": "/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/bin/python",
    "prefix": "/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310",
    "base_prefix": "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10",
    "real_prefix": null,
    "exec_prefix": "/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310",
    "base_exec_prefix": "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10",
    "path": [
      "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python310.zip",
      "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10",
      "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload",
      "/Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.10.10 (main, Feb 16 2023, 02:55:02) [Clang 14.0.0 (clang-1400.0.29.202)]",
  "makefile_filename": "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin/Makefile",
  "os": "<module 'os' from '/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/os.py'>",
  "site": "<module 'site' from '/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site.py'>",
  "datetime": "<module 'datetime' from '/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/datetime.py'>",
  "math": "<module 'math' from '/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/math.cpython-310-darwin.so'>",
  "json": "<module 'json' from '/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py'>"
} [virtualenv/run/session.py:51]
py310: 2958 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/sz/Library/Application Support/virtualenv) [virtualenv/run/session.py:55]
py310: 2959 D install pip from wheel /Users/sz/.local/pipx/venvs/tox/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-23.0.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py310: 2960 D install setuptools from wheel /Users/sz/.local/pipx/venvs/tox/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/setuptools-67.4.0-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py310: 2960 D install wheel from wheel /Users/sz/.local/pipx/venvs/tox/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/wheel-0.38.4-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47]
py310: 2964 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/wheel [virtualenv/util/path/_sync.py:36]
py310: 2964 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools-67.4.0.dist-info to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/setuptools-67.4.0.dist-info [virtualenv/util/path/_sync.py:36]
py310: 2964 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.dist-info to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/pip-23.0.1.dist-info [virtualenv/util/path/_sync.py:36]
py310: 2996 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/pip [virtualenv/util/path/_sync.py:36]
py310: 2997 D copy /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools-67.4.0.virtualenv to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/setuptools-67.4.0.virtualenv [virtualenv/util/path/_sync.py:36]
py310: 3001 D copy /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/distutils-precedence.pth to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:36]
py310: 3007 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/setuptools to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/setuptools [virtualenv/util/path/_sync.py:36]
py310: 3052 D copy /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.virtualenv to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/wheel-0.38.4.virtualenv [virtualenv/util/path/_sync.py:36]
py310: 3058 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.dist-info to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/wheel-0.38.4.dist-info [virtualenv/util/path/_sync.py:36]
py310: 3102 D generated console scripts wheel-3.10 wheel wheel3.10 wheel3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py310: 3450 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/pkg_resources to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/pkg_resources [virtualenv/util/path/_sync.py:36]
py310: 3521 D copy directory /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-67.4.0-py3-none-any/_distutils_hack to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:36]
py310: 3524 D generated console scripts  [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py310: 4019 D copy /Users/sz/Library/Application Support/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.virtualenv to /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/lib/python3.10/site-packages/pip-23.0.1.virtualenv [virtualenv/util/path/_sync.py:36]
py310: 4023 D generated console scripts pip-3.10 pip3 pip pip3.10 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41]
py310: 4023 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:61]
py310: 4047 D write /Users/sz/Documents/stanislav/git/tox-ipython/.tox/py310/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30]
py310: 4047 D 	home = /usr/local/opt/python@3.10/bin [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	version_info = 3.10.10.final.0 [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	virtualenv = 20.20.0 [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	base-prefix = /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	base-exec-prefix = /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 4047 D 	base-executable = /usr/local/opt/python@3.10/bin/python3.10 [virtualenv/create/pyenv_cfg.py:34]
py310: 4052 W install_deps> python -I -m pip install ipython 'pytest<8,>=7' [tox/tox_env/api.py:428]
Collecting ipython
  Using cached ipython-8.11.0-py3-none-any.whl (793 kB)
Collecting pytest<8,>=7
  Using cached pytest-7.2.2-py3-none-any.whl (317 kB)
Collecting stack-data
  Using cached stack_data-0.6.2-py3-none-any.whl (24 kB)
Collecting traitlets>=5
  Using cached traitlets-5.9.0-py3-none-any.whl (117 kB)
Collecting pexpect>4.3
  Using cached pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
Collecting jedi>=0.16
  Using cached jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)
Collecting pickleshare
  Using cached pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30
  Using cached prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
Collecting appnope
  Using cached appnope-0.1.3-py2.py3-none-any.whl (4.4 kB)
Collecting decorator
  Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting backcall
  Using cached backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting matplotlib-inline
  Using cached matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)
Collecting pygments>=2.4.0
  Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB)
Collecting exceptiongroup>=1.0.0rc8
  Using cached exceptiongroup-1.1.0-py3-none-any.whl (14 kB)
Collecting iniconfig
  Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting pluggy<2.0,>=0.12
  Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting attrs>=19.2.0
  Using cached attrs-22.2.0-py3-none-any.whl (60 kB)
Collecting tomli>=1.0.0
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting packaging
  Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting parso<0.9.0,>=0.8.0
  Using cached parso-0.8.3-py2.py3-none-any.whl (100 kB)
Collecting ptyprocess>=0.5
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
Collecting executing>=1.2.0
  Using cached executing-1.2.0-py2.py3-none-any.whl (24 kB)
Collecting asttokens>=2.1.0
  Using cached asttokens-2.2.1-py2.py3-none-any.whl (26 kB)
Collecting pure-eval
  Using cached pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: wcwidth, pure-eval, ptyprocess, pickleshare, executing, backcall, appnope, traitlets, tomli, six, pygments, prompt-toolkit, pluggy, pexpect, parso, packaging, iniconfig, exceptiongroup, decorator, attrs, pytest, matplotlib-inline, jedi, asttokens, stack-data, ipython
Successfully installed appnope-0.1.3 asttokens-2.2.1 attrs-22.2.0 backcall-0.2.0 decorator-5.1.1 exceptiongroup-1.1.0 executing-1.2.0 iniconfig-2.0.0 ipython-8.11.0 jedi-0.18.2 matplotlib-inline-0.1.6 packaging-23.0 parso-0.8.3 pexpect-4.8.0 pickleshare-0.7.5 pluggy-1.0.0 prompt-toolkit-3.0.38 ptyprocess-0.7.0 pure-eval-0.2.2 pygments-2.14.0 pytest-7.2.2 six-1.16.0 stack-data-0.6.2 tomli-2.0.1 traitlets-5.9.0 wcwidth-0.2.6
py310: 25661 I exit 0 (21.60 seconds) /Users/sz/Documents/stanislav/git/tox-ipython> python -I -m pip install ipython 'pytest<8,>=7' pid=83844 [tox/execute/api.py:275]
py310: 25663 W commands[0]> pytest --trace --pdbcls=IPython.terminal.debugger:TerminalPdb [tox/tox_env/api.py:428]
ipdb>






       
>>>>>>>>>>>>>>>>>>>> PDB runcall (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>
> �[0;32m/Users/sz/Documents/stanislav/git/tox-ipython/test_fail.py�[0m(2)�[0;36mtest_success�[0;34m()�[0m
�[0;32m      1 �[0;31m�[0;32mdef�[0m �[0mtest_success�[0m�[0;34m(�[0m�[0;34m)�[0m�[0;34m:�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m----> 2 �[0;31m    �[0massertion�[0m �[0;34m=�[0m �[0;32mTrue�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m      3 �[0;31m    �[0;32massert�[0m �[0massertion�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m      4 �[0;31m�[0;34m�[0m�[0m
�[0m�[0;32m      5 �[0;31m�[0;31m# def test_fail():�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m
nipdb> n
ipdb>






       > �[0;32m/Users/sz/Documents/stanislav/git/tox-ipython/test_fail.py�[0m(3)�[0;36mtest_success�[0;34m()�[0m
�[0;32m      1 �[0;31m�[0;32mdef�[0m �[0mtest_success�[0m�[0;34m(�[0m�[0;34m)�[0m�[0;34m:�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m      2 �[0;31m    �[0massertion�[0m �[0;34m=�[0m �[0;32mTrue�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m----> 3 �[0;31m    �[0;32massert�[0m �[0massertion�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m�[0;32m      4 �[0;31m�[0;34m�[0m�[0m
�[0m�[0;32m      5 �[0;31m�[0;31m# def test_fail():�[0m�[0;34m�[0m�[0;34m�[0m�[0m
�[0m
assert
             assert   
             assertion
             assert   

             keyword ion
             assert   
             assertion
             <unknown> 

             assertion
            
             assert   

             keyword ion
             assert   
             assertion
             <unknown> 

             assertion
            
             assert   

             keyword ion
             assert   
             assertion
             <unknown> 
 
 
               cipdb> assertionc
ipdb>






       *** NameError: name 'assertionc' is not defined
cipdb> c

>>>>>>>>>>>>>>>>>>>>> PDB continue (IO-capturing resumed) >>>>>>>>>>>>>>>>>>>>>>
.                                                                        [100%]
1 passed in 22.55s
py310: 49622 I exit 0 (23.95 seconds) /Users/sz/Documents/stanislav/git/tox-ipython> pytest --trace --pdbcls=IPython.terminal.debugger:TerminalPdb pid=83959 [tox/execute/api.py:275]
  py310: OK (48.93=setup[24.97]+cmd[23.95] seconds)
  congratulations :) (49.12 seconds)

Minimal example

If possible, provide a minimal reproducer for the issue:

  • tox.ini
    [tox]
    env_list =
        py310
    minversion = 4.4.6
    
    [testenv]
    description = run the tests with pytest
    deps =
        pytest>=7,<8
        ipython
    commands =
        pytest {tty:--color=yes} {posargs}
    
    passenv = *
  • .tox/py310/bin/pip freeze
    appnope==0.1.3
    asttokens==2.2.1
    attrs==22.2.0
    backcall==0.2.0
    decorator==5.1.1
    exceptiongroup==1.1.0
    executing==1.2.0
    iniconfig==2.0.0
    ipython==8.11.0
    jedi==0.18.2
    matplotlib-inline==0.1.6
    packaging==23.0
    parso==0.8.3
    pexpect==4.8.0
    pickleshare==0.7.5
    pluggy==1.0.0
    prompt-toolkit==3.0.38
    ptyprocess==0.7.0
    pure-eval==0.2.2
    Pygments==2.14.0
    pytest==7.2.2
    six==1.16.0
    stack-data==0.6.2
    tomli==2.0.1
    traitlets==5.9
    
  • test_fail.py
    def test_success():
        assertion = True
        assert assertion
@gaborbernat
Copy link
Member

PR welcome to fix this 😊

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 27, 2023
@ziima
Copy link
Contributor

ziima commented Apr 5, 2023

pdb works since #2711, but ipdb doesn't.

@ziima
Copy link
Contributor

ziima commented Apr 5, 2023

Narrowed it down to ipython's prompt_toolkit layer, because ipython used with --simple-prompt works correctly:

# Assuming py311 env has ipython installed.
tox exec --skip-pkg-install -e py311 -- ipython3 --simple-prompt

but full prompt using prompt_toolkit doesn't and is broken the same way as shown in the description:

tox exec --skip-pkg-install -e py311 -- ipython3 --simple-prompt

Edit: Probably applies to any prompt_toolkit based application. Tested on another app.

@gaborbernat
Copy link
Member

Seems the issue is in prompt_toolkit rather than here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

3 participants