diff options
Diffstat (limited to 'tests/functional_tests/util_resources.py')
-rwxr-xr-x | tests/functional_tests/util_resources.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/functional_tests/util_resources.py b/tests/functional_tests/util_resources.py index c12506146..36a5fa32c 100755 --- a/tests/functional_tests/util_resources.py +++ b/tests/functional_tests/util_resources.py @@ -37,6 +37,8 @@ from __future__ import print_function import subprocess import psutil +import os +import errno def available_ram_gb(): ram_bytes = psutil.virtual_memory().available @@ -51,3 +53,26 @@ def get_time_pi_seconds(cores, app_dir='.'): miliseconds = int(decoded) return miliseconds / 1000.0 + +def remove_file(name): + WALLET_DIRECTORY = os.environ['WALLET_DIRECTORY'] + assert WALLET_DIRECTORY != '' + try: + os.unlink(WALLET_DIRECTORY + '/' + name) + except OSError as e: + if e.errno != errno.ENOENT: + raise + +def get_file_path(name): + WALLET_DIRECTORY = os.environ['WALLET_DIRECTORY'] + assert WALLET_DIRECTORY != '' + return WALLET_DIRECTORY + '/' + name + +def remove_wallet_files(name): + for suffix in ['', '.keys', '.background', '.background.keys', '.address.txt']: + remove_file(name + suffix) + +def file_exists(name): + WALLET_DIRECTORY = os.environ['WALLET_DIRECTORY'] + assert WALLET_DIRECTORY != '' + return os.path.isfile(WALLET_DIRECTORY + '/' + name) |