You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,7 @@ Before we set up Pytest in VS Code, you need to install the below prerequisites
13
13
## Setting Up Pytest In VS Code
14
14
To set up Pytest in VS Code, follow the steps described below-
15
15
Check the pip version installed and use the set up version to work with pytest -
16
-
* Pip3 install pytest
17
-
* Pip3 show pytest : To check the version
16
+
* Pip install pytest
18
17
19
18
## Installing Python Extension in VS Code
20
19
Open your VS Code and search for Python on the extensions. You’ll find the Python extension at the top of the search result. Select and click install.
@@ -31,9 +30,12 @@ Now click on “Configure Python Tests”, select pytest and the test code libra
31
30
## Settting up virtual environment
32
31
Pytest is particularly effective in virtual environments when VSCode is utilized. A virtual environment is a way to create an environment that is built-in. A folder is created by a virtual environment that contains a copy to a specific interpreter. Installing packages in a virtual environment will result in a new folder that is isolated from other packages used by other workspaces.
33
32
Working in virtual environments-
34
-
Pyenv is a library to work with different python environments-
35
-
* brew install pyenv
36
-
* pyenv install 3.13
33
+
open the Command Palette (⇧⌘P), search for the Python: Create Environment command, and select it
If you are creating an environment using Venv, the command presents a list of interpreters that can be used as a base for the new virtual environment.
38
+
The Python: Select Interpreter command displays a list of available environments, select the virtual env
37
39
38
40
## Add libraries to be used in the package to requirements.txt :
39
41
**Set up requirements.txt for required packages**
@@ -46,7 +48,7 @@ Pyenv is a library to work with different python environments-
46
48
*[pytest-cov](https://pypi.org/project/pytest-cov/) : pytest plugin to render coverage reports.
47
49
* pre-commit : maange pre commit hooks
48
50
49
-
To install the set up: pip3 install -r requirements.txt
51
+
To install the set up: pip install -r requirements.txt
50
52
51
53
## Report view in VScode console TEST RESULTS :
52
54
The report view provides report after execution of tests in TEST RESULTS tab in VScode. The results are in html format using pytest-html format of report structure woth pytest-cov that gives stats on test execution and code coverage at the end of each run.
0 commit comments