lnprototest is a set of test helpers written in Python3, designed to make it easy to write new tests when you propose changes to the lightning network protocol, as well as test existing implementations.
To install the necessary dependences
pip3 install poetry
poetry shell
poetry install
Well, now we can run the test
The simplest way to run is with the "dummy" runner:
make check
Here are some other useful pytest options:
-n8
to run 8-way parallel.-x
to stop on the first failure.--pdb
to enter the debugger on first failure.--trace
to enter the debugger on every test.-k foo
to only run tests with 'foo' in their name.tests/test_bolt1-01-init.py
to only run tests in that file.tests/test_bolt1-01-init.py::test_init
to only run that test.--log-cli-level={LEVEL_NAME}
to enable the logging during the test execution.The more useful way to run is to use an existing implementation. So far, core-lightning is supported. You will need:
bitcoind
installed, and in your path.lightningd
compiled with
--enable-developer
. By default the source directory should be
../lightning
relative to this directory, otherwise use
export LIGHTNING_SRC=dirname
.pip3 install -r lnprototest/clightning/requirements.txt
.Then you can run
make check PYTEST_ARGS='--runner=lnprototest.clightning.Runner'
or directly:
pytest --runner=lnprototest.clightning.Runner
If you want to write new tests or new backends, see HACKING.md.
Let's keep the sats flowing!
Rusty.