forked from coccoinomane/web3cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.py
More file actions
29 lines (21 loc) · 782 Bytes
/
Copy pathhelper.py
File metadata and controls
29 lines (21 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Helper functions to better run tests"""
import os
import secrets
import string
from web3cli.framework.app import App
def get_test_config_file() -> str:
"""Path to the config file that the app will use while running tests"""
return os.path.join(
os.path.expanduser("~"), ".web3cli", "config", "web3cli_test.yml"
)
def delete_test_config_file(app: App) -> None:
"""Delete the configuration file for the test app"""
file = get_test_config_file()
if os.path.isfile(file):
os.remove(file)
def get_random_string(
n: int = 6, set: str = string.ascii_lowercase + string.digits
) -> str:
"""Return a random string of length 'n', picking characters from
the given set"""
return "".join(secrets.choice(set) for _ in range(n))