Run tests locally

We use Flake8 for linting and PyTest for testing.

Lint

The Flake8 configuration is inside the .flake8 file.

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

You can lint with the following command:

$ flake8 --statistics

As optional, you can create a GitHub Hook to automatically check that your code follows the linting rules before committing your changes.

Lint automatically with hooks

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.

$ 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}"

You have to replace ${TOKEN} with the token symbol you are testing in lower case

Last updated