Unverified Commit 143a4dba authored by per1234's avatar per1234 Committed by GitHub

[skip changelog] Consolidate integration test instructions (#972)

Previously, instructions for running integration tests were present both in CONTRIBUTING.md as well as
in test/README.md.

Although most of the content was duplicated, there was
some important unique content on each page and the readers of one document would not necessarily know
of the existence of relevant information in the other.

Duplicate content is more work to maintain, and likely to end up becoming outdated.

So I have transfered the unique content from test/README.md to CONTRIBUTING.md and replaced it with a
link to that content.
parent 900654f4
......@@ -129,7 +129,9 @@ pip3 install --user poetry
For more installation options read the [official documentation][poetry-docs].
After Poetry has been installed you should be able to run the tests with:
#### Running tests
After the software requirements have been installed you should be able to run the tests with:
```shell
task test-integration
......@@ -138,6 +140,28 @@ task test-integration
This will automatically install the necessary dependencies, if not already installed, and run the integration tests
automatically.
To run specific modules you must run `pytest` from the virtual environment created by Poetry.
```shell
poetry run pytest test/test_lib.py
```
To run very specific test functions:
```shell
poetry run pytest test/test_lib.py::test_list
```
You can avoid writing the `poetry run` prefix each time by creating a new shell inside the virtual environment:
```shell
poetry shell
pytest test_lib.py
pytest test_lib.py::test_list
```
#### Linting and formatting
When editing any Python file in the project remember to run linting checks with:
```shell
......
......@@ -3,66 +3,4 @@
This dir contains integration tests, aimed to test the Command Line Interface and its output from a pure user point of
view.
## Installation
See also [Contributing][0].
To run the integration tests you must install [Poetry][poetry-website].
```shell
pip3 install --user poetry
```
For more installation options read the [official documentation][poetry-docs].
## Running tests
To run all the tests from the project's root folder:
```shell
task test-integration
```
This will create and install all necessary dependencies if not already existing and then run integrations tests.
To run specific modules you must run `pytest` from the virtual environment created by Poetry. If dependencies have not
already been installed first run `poetry install`.
```shell
poetry run pytest test/test_lib.py
```
To run very specific test functions:
```shell
poetry run pytest test/test_lib.py::test_list
```
You can avoid writing the `poetry run` prefix each time by creating a new shell inside the virtual environment:
```shell
poetry shell
pytest test_lib.py
pytest test_lib.py::test_list
```
## Linting and formatting
To run lint check from the project's root folder:
```shell
task python:check
```
This will run `flake8` automatically and return any error in the code formatting, if not already installed it will also
install integration tests dependencies.
In case of linting errors you should be able to solve most of them by automatically formatting with:
```shell
task python:format
```
[0]: ../docs/CONTRIBUTING.md
[poetry-website]: https://python-poetry.org/
[poetry-docs]: https://python-poetry.org/docs/
For instructions, see the [contributing guide](../docs/CONTRIBUTING.md/#integration-tests).
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment