# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://phoenix-7.gitbook.io/nodechain-en/develop/how-to/run-tests-locally.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
