From 03e1db57c0c40a1db1f6852411f749f14a645d8d Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 23 Sep 2020 07:10:09 -0700 Subject: [PATCH] [skip changelog] Consolidate integration test instructions 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. --- docs/CONTRIBUTING.md | 26 +++++++++++++++++- test/README.md | 64 +------------------------------------------- 2 files changed, 26 insertions(+), 64 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 796a8777838..7bf4c2959ca 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -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 diff --git a/test/README.md b/test/README.md index c05d5d8621c..1ead84eadb6 100644 --- a/test/README.md +++ b/test/README.md @@ -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).