microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
40 stars 17 forks source link

Unable to Execute Third-Party Unit Test Package with VSCode Debugger #349

Open TeomanEgeSelcuk opened 1 month ago

TeomanEgeSelcuk commented 1 month ago

VS Code Version: 1.89.1 OS Version: 23H2 (Windows 11)

Steps to Reproduce:

  1. Create a new Python project in VSCode with a virtual environment (myenv) and install DeepEval using pip.
  2. Create a wrapper script (run_deepeval.py) to handle the DeepEval command.
  3. Configure the launch.json file with the following settings:
    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Deepeval",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/langchain_env/run_deepeval.py",
            "args": [
                "test",
                "run",
                "${workspaceFolder}/tests/test_${fileBasename}"
            ],
            "debugStdLib": true,
            "justMyCode": true
        }
    ]
    }
  4. Try to debug the project using the VSCode debugger.

Expected Behavior: The VSCode debugger should execute the DeepEval package and run the unit tests successfully.

Actual Behavior: The VSCode debugger throws an error:

C:\Users\myuser\anaconda3\envs\myenv\python.exe: No module named deepeval.__main__; 'deepeval' is a package and cannot be directly executed

Additional Information:

Question: How can I configure VSCode to properly execute the DeepEval package within the debugger? Is there something wrong with my launch.json configuration, or is there a better way to set this up?

paulacamargo25 commented 2 weeks ago

@TeomanEgeSelcuk thanks for your issue report, it looks that there is an issue with your script, could you manage it to work just in the terminal? could you send me how you execute it?