HomePhabricator

[electrum] fix the temp datadir removal for functional tests

Description

[electrum] fix the temp datadir removal for functional tests

Summary:
The temporary data dir is not necessarily located in /tmp, it depends on the OS and access permissions.
Checking for _datadir.startswith("/tmp") caused the tests to fail on systems with the tmp dir in /var/tmp.

Also move the filesystem operations out of start/stop_ec_daemon, so that it becomes more clear that the function creating the directory is responsible for it's deletion, and that no intermediate operation is done to mutate the path (clarifies that we don't delete something else than the tmp directory).

Also remove some assertions that _datadir is not None after _datadir = tempfile.mkdtemp(), because mkdtemp never returns None, it errors on failure. Keep an assertion in start_ec_daemon to make it clear that this need to be called after make_electrum_data_dir

Test Plan: pytest electrum/electrumabc/tests/regtest

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
PiRKAuthored on Jul 18 2023, 12:05
PiRKPushed on Jul 18 2023, 13:03
Reviewer
Restricted Project
Differential Revision
D14278: [electrum] fix the temp datadir removal for functional tests
Parents
rABC8994e8de1ec5: [electrum] install also the basic dependencies when running functional tests
Branches
Unknown
Tags
Unknown