HomePhabricator

[electrum] restart the Electrum ABC daemon with a fresh datadir for every test

Description

[electrum] restart the Electrum ABC daemon with a fresh datadir for every test

Summary:
It is better if the various tests share as little state as possible, so make sure they all have their own Electrum ABC daemon with a fresh wallet and datadir.
Restrict the scope fulcrum_service fixture to function, create and delete the datadir for every test function.

This removes a global variable.

Also note that the bitcoind_rpc_connection already assigns the _bitcoind global variable the first time it is called, so there is no need to redo it in fulcrum_service.

It would be good to also restart/reset the bitcoind instance and the fulcrum instance between tests, but I was not able to find any pytest-docker documentation about how to do that. The indivudual tests can mine blocks and send funds from the bitcoind wallet, so there is still some shared state between tests.

Test Plan: pytest electrum/electrumabc/tests/regtest

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14293

Details

Provenance
PiRKAuthored on Jul 20 2023, 06:52
PiRKPushed on Jul 20 2023, 09:32
Reviewer
Restricted Project
Differential Revision
D14293: [electrum] restart the Electrum ABC daemon with a fresh datadir for every test
Parents
rABC774d5ea48262: [electrum] use the docker-compose command for functional tests
Branches
Unknown
Tags
Unknown