Skip to content

Commit 295afde

Browse files
authored
Mention vscode tasks as alternative to shell commands (#2481)
1 parent 865a38b commit 295afde

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/development_testing.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ To run the full test suite, more dependencies are required than what is set up i
2323
uv pip install -r requirements_test_all.txt
2424
```
2525

26+
Or, in Visual Studio Code, launch the **Install all Test Requirements** task.
27+
2628
To start the tests, and run the full test suite, activate the virtual environment and run the command:
2729

2830
```shell
2931
pytest tests
3032
```
3133

34+
Or, in Visual Studio Code, launch the **Pytest** task.
35+
3236
It might be required that you install additional packages depending on your distribution/operating system:
3337

3438
- Fedora: `sudo dnf -y install systemd-devel gcc-c++`
@@ -53,6 +57,9 @@ Next you can update all dependencies in your development environment by running:
5357
```shell
5458
uv pip install -r requirements_test_all.txt
5559
```
60+
61+
Or, in Visual Studio Code, launch the **Install all Test Requirements** task.
62+
5663
### Running a limited test suite
5764

5865
You can pass arguments to `pytest` to be able to run single test suites or test files.
@@ -79,6 +86,8 @@ the following command is recommended:
7986
pytest ./tests/components/<your_component>/ --cov=homeassistant.components.<your_component> --cov-report term-missing -vv
8087
```
8188

89+
Or, in Visual Studio Code, launch the **Code Coverage** task.
90+
8291
### Preventing linter errors
8392

8493
Several linters are setup to run automatically when you try to commit as part of running `script/setup` in the [virtual environment](development_environment.mdx).
@@ -89,6 +98,8 @@ You can also run these linters manually :
8998
pre-commit run --show-diff-on-failure
9099
```
91100

101+
Or, in Visual Studio Code, launch the **Pre-commit** task.
102+
92103
The linters are also available directly, you can run tests on individual files:
93104

94105
```shell
@@ -162,6 +173,8 @@ the `--snapshot-update` flag:
162173
pytest tests/components/example/test_sensor.py --snapshot-update
163174
```
164175

176+
Or, in Visual Studio Code, launch the **Update syrupy snapshots** task.
177+
165178
This will create a snapshot file in the `tests/components/example/snapshots`.
166179
The snapshot file is named after the test file, in this case `test_sensor.ambr`,
167180
and is human-readable. The snapshot files must be committed to the repository.

0 commit comments

Comments
 (0)