Skip to content

Debug Unit Tests (Pytest) do not loading envFile #1759

@FlavioCestari

Description

@FlavioCestari

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: Windows 7 Enterprise
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: pytest

Actual behavior

Vscode don't load envFile vars in "Debug Unit Tests (Pytest)" mode, only in "Run Unit Tests (Pytest)" mode or in default "Debug/Run" modes.

Expected behavior

To load envFile vars to os.environ

Steps to reproduce:

  1. Config envFile:
    "python.envFile": "${workspaceFolder}/dev.env",

2.Config PyTest

"python.unitTest.pyTestArgs": [          
        "-v", // increase verbosity
        "-l", // show locals in tracebacks
        "-x", // exit instantly on first error or failed test
        "--ff", // run all tests but run the last failures first
        "--show-capture=all", // captured stdout/stderr/log is shown on failed tests
        "--color=yes", // color terminal output (yes/no/auto)
        //"--rootdir=${workspaceFolder}/",
        "tests", // starting directory for discovering tests
    ],
"python.unitTest.pyTestEnabled": true

3.Vscode cmd: > Python: Debug All Unit Tests

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions