Running the Tests¶
The commands are run from the root of the repository: the tests read tests/config/config.ini from there, and write their wallets and logs there. The integration tests also need the network of Test Environment.
| Page | What it has |
|---|---|
| Choosing the Tests | by marker, file, class, test or name, and the order of the wallet tests |
| Results and Logs | what each outcome means, the summaries, the logs, stopping and resuming |
| Debugging | the debugger, the slowest tests, the reruns and the timeouts |
| Local Coverage | the coverage of the tests and of the C++, on your machine |
Set up¶
- Build monero-cpp and the module, as in Build on Linux and macOS:
./bin/build_monero_cpp.sh cmake -B build -Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)" cmake --build build - Make the virtual environment, with the versions of the tools that CI uses, and activate it:
./bin/setup_venv.sh . .venv/bin/activatesetup_venv.shinstalls the tools of the build, of the tests and of the docs. For the tests only:pip install -r tests/requirements.txt. - Make the module importable: Or install it in the environment with
export PYTHONPATH="$PWD/build"pip install ., which builds it again. After a change of the C++ of the module, build it again withcmake --build build: the tests run the module that is inbuild/. - For the integration tests, start the network:
./bin/setup_test_environment.sh
Run pytest from the environment, or as python -m pytest. The /usr/bin/pytest of the python3-pytest package of apt calls pytest.console_main(), which pytest 9 deprecates: with the pytest of the environment it prints a PytestRemovedIn10Warning.
The whole suite¶
pytest # every test: the network has to be up
pytest -m unit # the unit tests, no server needed, half a minute
pytest -m integration # the integration tests, about 45 minutes
Clean up¶
./bin/cleanup_test_environment.sh
It removes the containers with their volumes, the wallets of test_wallets/, the logs, .pytest_cache and the __pycache__ folders of the project.