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

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

Closed
FlavioCestari opened this issue May 28, 2018 · 3 comments · Fixed by #1825
Closed

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

FlavioCestari opened this issue May 28, 2018 · 3 comments · Fixed by #1825
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@FlavioCestari
Copy link

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

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug needs verification area-testing labels May 29, 2018
@DonJayamanne DonJayamanne self-assigned this May 29, 2018
@DonJayamanne
Copy link

DonJayamanne commented May 29, 2018

@FlavioCestari
I'm unable to replicate this at my end. Please could you upload a repo I could use to test this.

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster and removed needs verification labels May 29, 2018
@DonJayamanne DonJayamanne removed their assignment May 29, 2018
@FlavioCestari
Copy link
Author

@DonJayamanne
Please check the attach code example.
See the files "PyTestRunningLog.log" and "PyTestDebuggingLogError.log".

ExampleDebugginPyTest.zip

@DonJayamanne DonJayamanne added needs PR and removed info-needed Issue requires more information from poster labels May 31, 2018
@DonJayamanne DonJayamanne self-assigned this May 31, 2018
@DonJayamanne
Copy link

@FlavioCestari Thanks, managed to replicate it.

@brettcannon brettcannon added this to the June 2018 milestone Jun 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 16, 2018
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants