Skip to content

[skip changelog] Consolidate integration test instructions #972

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

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
64 changes: 1 addition & 63 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).