> For the complete documentation index, see [llms.txt](https://phoenix-7.gitbook.io/nodechain-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phoenix-7.gitbook.io/nodechain-en/develop/how-to/run-tests-locally.md).

# Run tests locally

We use [Flake8](https://flake8.pycqa.org/en/latest/) for linting and [PyTest](https://docs.pytest.org/en/6.2.x/) for testing.

## Lint

The Flake8 configuration is inside the `.flake8` file.&#x20;

The project is configured only for linting python code from the `Connector/` and `scripts/` directories.

You can lint with the following command:

```shell
$ flake8 --statistics
```

As optional, you can create a [GitHub Hook](https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks) to automatically check that your code follows the linting rules before committing your changes.

{% content-ref url="/pages/agC7ERuSgINTaP3pE9Yi" %}
[Lint automatically with hooks](/nodechain-en/develop/how-to/lint-automatically-with-hooks.md)
{% endcontent-ref %}

## Local testing

You can do the local testing manually:

1. Lint the project using the instructions above.
2. Use the `scripts/nodechain.py` script to launch NodeChain in **regtest** network locally and select the token you want to test.
3. Run tests inside the Connector docker container with the following command.&#x20;

```shell
$ docker exec -it ${TOKEN}_regtest_api_connector_1 bash -c "cd Connector && python -m pytest -c tests/${TOKEN}/pytest_${TOKEN}.ini -s --cov=${TOKEN}/ --cov=logger/ --cov=rpcutils/ --cov=wsutils/ tests/${TOKEN}"
```

{% hint style="info" %}
You have to replace `${TOKEN}` with the token symbol you are testing in lower case
{% endhint %}
