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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
