Page MenuHomePhabricator

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

Authored by PiRK on Jul 20 2023, 07:05.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Branch
docker-compose
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24559
Build 48715: Build Diffelectrum-tests
Build 48714: arc lint + arc unit