feat: test nanosp

This commit is contained in:
Coline
2022-06-23 10:32:41 +02:00
parent e069e2c2f1
commit 1ae8042d09
7 changed files with 152 additions and 146 deletions

View File

@@ -10,6 +10,9 @@ from ethereum_client.ethereum_cmd import EthereumCommand
SCRIPT_DIR = Path(__file__).absolute().parent
API_URL = "http://127.0.0.1:5000"
VERSION = {"nanos": "2.1", "nanox": "2.0.2", "nanosp": "1.0"}
def pytest_addoption(parser):
# nanos or nanox
parser.addoption("--model", action="store", default="nanos")
@@ -21,12 +24,8 @@ def pytest_addoption(parser):
def client(pytestconfig):
file_path = SCRIPT_DIR.parent.parent / "bin" / "app.elf"
model = pytestconfig.getoption("model")
version = '2.1' # latest version of nanos_sdk
if model == "nanox":
version = '2.0.2' # latest version of nanox_sdk
args = ['--log-level', 'speculos:DEBUG','--model', model, '--display', pytestconfig.getoption("display"), '--sdk', version]
args = ['--log-level', 'speculos:DEBUG','--model', model, '--display', pytestconfig.getoption("display"), '--sdk', VERSION[model]]
with SpeculosClient(app=str(file_path), args=args) as client:
yield client