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

Cannot debug pytest if jupyterlab is installed #16093

Closed
danieltuzes opened this issue Apr 29, 2021 · 3 comments
Closed

Cannot debug pytest if jupyterlab is installed #16093

danieltuzes opened this issue Apr 29, 2021 · 3 comments
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@danieltuzes
Copy link

danieltuzes commented Apr 29, 2021

Environment data

  • VS Code version: 1.55.2
  • Extension version (available under the Extensions sidebar): v2021.4.765268190
  • OS and version: Windows Version 10.0.18363 Build 18363
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.4 (but with python 3.8.8. too)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions:
pytest 6.2.3, 
jupyter core     : 4.7.1
jupyter-notebook : 6.3.0
qtconsole        : 5.0.3
ipython          : 7.22.0
ipykernel        : 5.3.4
jupyter client   : 6.1.12
jupyter lab      : 3.0.14
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5
jupyter-lab : 3.0.14
  • Value of the python.languageServer setting: ms-python.vscode-pylance v2021.4.3

When I have a fresh conda environment installed with python 3.9.4 and install the following requirements

numpy
pandas
pytest
pylint
mccabe
pyflakes
pylama
pydocstyle
pycodestyle
coverage

I can discover, run and debug my code from VS Code.

Expected behaviour

Once I install jupyter and jupyterlab with conda, I should still able to discover, run and debug pytests.

Actual behaviour

I can only discover and run the tests from VS Code after I install jupyterlab. In the output tab I get

Error: TypeError: Cannot read property 'testsuites' of null

and in the debug console tab I get

Traceback (most recent call last):
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\pyvsc-run-isolated.py", line 30, in <module>
    runpy.run_path(module, run_name="__main__")
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\testlauncher.py", line 51, in <module>
    run(cwd, testRunner, args)
  File "c:\Users\tuzes\.vscode\extensions\ms-python.python-2021.4.765268190\pythonFiles\testlauncher.py", line 39, in run
    pytest.main(args)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\config\__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\config\__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\callers.py", line 203, in _multicall
    gen.send(outcome)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\config\__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\config\__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\config\__init__.py", line 1172, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\pluggy\manager.py", line 299, in load_setuptools_entrypoints
    plugin = ep.load()
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\anyio\__init__.py", line 25, in <module>
    from ._core._sockets import (
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\_pytest\assertion\rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\site-packages\anyio\_core\_sockets.py", line 2, in <module>
    import ssl
  File "C:\Users\tuzes\miniconda3\envs\prng\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed while importing _ssl: The specified module could not be found.

Steps to reproduce:

Clone my repo https://github.com/danieltuzes/studies, cd into randuti_dev, install the requirements, install this modul with pip install -e ., and you will see that you can debug the tests.

@danieltuzes danieltuzes added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Apr 29, 2021
@danieltuzes danieltuzes changed the title Cannot debug pytest if jupyter is installed Cannot debug pytest if jupyterlab is installed Apr 29, 2021
@karthiknadig karthiknadig added area-testing triage and removed triage-needed Needs assignment to the proper sub-team labels May 3, 2021
@karrtikr
Copy link

karrtikr commented May 3, 2021

Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority.

Thanks for your understanding and patience!

@karrtikr
Copy link

karrtikr commented May 3, 2021

@danieltuzes It seems that your environment is likely broken. Can you try running that command outside of VSCode in terminal and see if it works? To see the command we run, check and please provide the logs as mentioned in the issue template.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output for Python Test Log in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Test Log)

XXX

@karrtikr karrtikr added the info-needed Issue requires more information from poster label May 3, 2021
@danieltuzes
Copy link
Author

Sorry, my bad, I followed #4300 and now it seems it is ok.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants