diff --git a/docs/development_testing.md b/docs/development_testing.md index 2c39f377..55e9cdc8 100644 --- a/docs/development_testing.md +++ b/docs/development_testing.md @@ -23,12 +23,16 @@ To run the full test suite, more dependencies are required than what is set up i uv pip install -r requirements_test_all.txt ``` +Or, in Visual Studio Code, launch the **Install all Test Requirements** task. + To start the tests, and run the full test suite, activate the virtual environment and run the command: ```shell pytest tests ``` +Or, in Visual Studio Code, launch the **Pytest** task. + It might be required that you install additional packages depending on your distribution/operating system: - 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: ```shell uv pip install -r requirements_test_all.txt ``` + +Or, in Visual Studio Code, launch the **Install all Test Requirements** task. + ### Running a limited test suite 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: pytest ./tests/components// --cov=homeassistant.components. --cov-report term-missing -vv ``` +Or, in Visual Studio Code, launch the **Code Coverage** task. + ### Preventing linter errors 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 : pre-commit run --show-diff-on-failure ``` +Or, in Visual Studio Code, launch the **Pre-commit** task. + The linters are also available directly, you can run tests on individual files: ```shell @@ -162,6 +173,8 @@ the `--snapshot-update` flag: pytest tests/components/example/test_sensor.py --snapshot-update ``` +Or, in Visual Studio Code, launch the **Update syrupy snapshots** task. + This will create a snapshot file in the `tests/components/example/snapshots`. The snapshot file is named after the test file, in this case `test_sensor.ambr`, and is human-readable. The snapshot files must be committed to the repository.