Skip to content

Commit

Permalink
docs: add documentation on how to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
merydian committed Mar 25, 2024
1 parent 3313293 commit 6f499be
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,49 @@ where `<qgis_plugins_path>` is one of:
- Windows: `C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ORStools`
- Mac OS: `Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ORStools`

### CI
#### Testing
The repository tests on the QGis Versions *3.16*, *3.22* and the *latest* version.
Until now, it's only possible to test one version at a time.

To do local test runs you can use a [conda installation](https://github.com/opengisch/qgis-conda-builder) of the QGis version you want to test.
You will also have to install *xvfb* to run the tests on involving an interface.
Lastly, we need [*Pytest*](https://docs.pytest.org/en/8.0.x/) to run tests in general.

To do the above run use these commands:
1. Install a version of anaconda, preferrably [*miniforge*](https://github.com/conda-forge/miniforge).

2. Create and prepare the environment.
```shell
# create environment
mamba create --name qgis_test
# activate envotonment
conda activate qgis_test
# install pip
mamba install qgis pip
```
3. Install QGis using mamba.
```shell
mamba install -c conda-forge qgis=[3.16, 3.22, latest] # choose one
```

4. Install *xvfb*
```shell
sudo apt-get update
sudo apt install xvfb
```

5. Install *Pytest* using pip in testing environment.
```shell
pip install -U pytest
```

To run the tests you will need an ORS-API key:
```shell
cd orstools-qgis-plugin
export ORS_API_KEY=[Your API key here] && xvfb-run pytest
```

### Debugging
In the **PyCharm community edition** you will have to use logging and printing to inspect elements.
The First Aid QGIS plugin can probably also be used additionally.
Expand Down

0 comments on commit 6f499be

Please sign in to comment.