From 1294aefd8b439122b90eb2075b3d91bd49015070 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:35:21 +0200 Subject: [PATCH 1/2] Update CONTRIBUTING.md. --- CONTRIBUTING.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index feea9260..055f0313 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,11 @@ We recommend working on a feature branch and pull request from there. -## Create a feature branch +## Requirements + +- `poetry`, +- `PyCharm` (recommended). + +## Creating a feature branch Make sure your environment contains all the updated versions of the dependencies. @@ -20,13 +25,11 @@ $ git checkout develop $ git fetch origin $ git pull $ git branch - ``` ## Before creating the pull request Make sure the tests and the following linters pass. - From a `poetry` shell (started from an OpenSquirrel checkout): ``` @@ -35,3 +38,31 @@ $ mypy . --strict $ poetry run isort . $ poetry run black . ``` + +## Setting the Python interpreter (PyCharm) + +You can choose the Python interpreter from the `poetry` environment. + +- Go to `Settings` > `Project: OpenSquirrel` > `Python Interpreter`. +- Click on `Add Interpeter`, and then select `Add Local Interpreter`. +- Select `Poetry Environment`, and then `Existing environment`. +- Click on `...` to navigate to the `Interpreter` binary. + +## Debugging (PyCharm) + +To run all tests: + +- Right-click on the `test` folder of the Project tree. +- Click `Debug 'pytest' in test`. + +This will also create a `Run/Debug Configuration`. + +### Troubleshooting + +If breakpoints are not hit during debugging: + +- Go to `Run/Debug Configurations`. +- Add `--no-cov` in the `Additional arguments` text box. + +This issue may be due to the code coverage module _hijacking_ the tracing mechanism +(check [this link](https://stackoverflow.com/a/56235965/260313) for a more detailed explanation). From 79f78e56ddb04dc87437a6804cd2b1c96a5926e1 Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:43:17 +0200 Subject: [PATCH 2/2] Update CONTRIBUTING.md. --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 055f0313..b078c414 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,12 +48,12 @@ You can choose the Python interpreter from the `poetry` environment. - Select `Poetry Environment`, and then `Existing environment`. - Click on `...` to navigate to the `Interpreter` binary. -## Debugging (PyCharm) +## Running/Debugging tests (PyCharm) -To run all tests: +To run/debug all tests: - Right-click on the `test` folder of the Project tree. -- Click `Debug 'pytest' in test`. +- Click `Run 'pytest' in test` or `Debug 'pytest' in test`. This will also create a `Run/Debug Configuration`.