Escape pytest in zsh terminal when debuging the tests
See original GitHub issueEnvironment data
- VS Code version: 1.32.3
- Extension version (available under the Extensions sidebar): 2019.2.5558
- OS and version: Fedora 29
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.2 64-bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Relevant/affected Python packages and their versions: N/A
Expected behaviour
Debug parameterized pytest by click the “bug” logo in the test tree view, the debugger should start.
Actual behaviour
Debug parameterized pytest (e.g. test_qpair_different_size[5] below), but cannot find the test. For normal pytest cases, the debug just works, e.g. test_create_device_invalid below.
Steps to reproduce:
- launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "debug pynvme script",
"type": "python",
"request": "test",
"console": "integratedTerminal",
"sudo": true
}
]
}
Logs
~/pynvme▶ cd /home/cranechu/pynvme ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 sudo /usr/bin/python3 /home/cranechu/.vscode/extensions/ms-python.python-2019.2.5558/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 40837 /home/cranechu/.vscode/extensions/ms-python.python-2019.2.5558/pythonFiles/testlauncher.py /home/cranechu/pynvme pytest --junitxml=/tmp/tmp-3191CZSiAJnJWSOU.xml --pciaddr=01:00.0 driver_test.py::test_qpair_different_size[5]
zsh: no matches found: driver_test.py::test_qpair_different_size[5]
~/pynvme▶ cd /home/cranechu/pynvme ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 sudo /usr/bin/python3 /home/cranechu/.vscode/extensions/ms-python.python-2019.2.5558/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 38197 /home/cranechu/.vscode/extensions/ms-python.python-2019.2.5558/pythonFiles/testlauncher.py /home/cranechu/pynvme pytest --junitxml=/tmp/tmp-3191X7ih17lf4bBg.xml --pciaddr=01:00.0 driver_test.py::test_create_device_invalid
pydev debugger: warning: trying to add breakpoint to file that does not exist: /home/cranechu/pynvme/scripts/test_nvme_spec.py (will have no effect)
================================== test session starts ==================================
platform linux -- Python 3.7.2, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/cranechu/pynvme, inifile: pytest.ini
plugins: cov-2.6.1
collected 1 item
...
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
Can I debug with python debugger when using py.test ...
it's real simple: put an assert 0 where you want to start debugging in your code and run your tests with: py.test --pdb....
Read more >Usage and Invocations — pytest documentation
You can invoke testing through the Python interpreter from the command line: ... Python comes with a builtin Python debugger called PDB. pytest...
Read more >pytest Documentation - Read the Docs
2.18 How to use unittest-based tests with pytest . ... but any newlines in a string will be escaped. ... How to set...
Read more >Dash Testing | Dash for Python Documentation | Plotly
dash.testing provides custom Dash pytest fixtures and a set of testing APIs for ... In some shells (for example, Zsh), you may need...
Read more >Please commands
To enable Please completions, add this line to your .bashrc or .zshrc : ... dbg is accepted for C++ and Go to build...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still experiencing this issue as of v2020.8.103604. A usable workaround is adding
unsetopt nomatch
to you ~/.zshrc.Hi,
I noticed that you are using mac os and the shell should be bash. I am using zsh in Fedora.
I added the configuration below, and it works!
But I still prefer to use zsh, so I did some experiments like this:
It seems quotation mark is required on “file_name::function_name[parameter]” in zsh by its default configuration.
Thanks!