Skip to content

Commit

Permalink
All all_nano option to the device paremeter in the base conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutin-ledger committed Jul 19, 2023
1 parent 1b4f6bd commit c7d55d8
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/ragger/conftest/base_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

BACKENDS = ["speculos", "ledgercomm", "ledgerwallet"]

DEVICES = ["nanos", "nanox", "nanosp", "stax", "all"]
DEVICES = ["nanos", "nanox", "nanosp", "stax", "all", "all_nano"]

FIRMWARES = [
Firmware.NANOS,
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_name(request):
test_name = request.node.name

# Remove firmware suffix:
# - test_xxx_transaction_ok[nanox 2.0.2]
# - test_xxx_transaction_ok[nanox]
# => test_xxx_transaction_ok
return test_name.split("[")[0]

Expand All @@ -88,25 +88,19 @@ def pytest_generate_tests(metafunc):
fw_list = []
ids = []

device = metafunc.config.getoption("device")
devices = metafunc.config.getoption("device")
backend_name = metafunc.config.getoption("backend")

if device == "all":
if backend_name != "speculos":
raise ValueError("Invalid device parameter on this backend")

# Add all supported firmwares
for fw in FIRMWARES:
fw_list.append(fw)
ids.append(fw.name)

else:
# Enable firmware for demanded device
for device in devices.split(','):

Check failure

Code scanning / CodeQL

Suspicious unused loop iteration variable Error

For loop variable 'device' is not used in the loop body.
# Enable firmware for requested devices
for fw in FIRMWARES:
if device == fw.name:
if devices == fw.name or devices == "all" or (devices == "all_nano" and fw.name.startswith("nano")):
fw_list.append(fw)
ids.append(fw.name)

if len(fw_list) > 1 and backend_name != "speculos":
raise ValueError("Invalid device parameter on this backend")

metafunc.parametrize("firmware", fw_list, ids=ids, scope="session")


Expand Down

0 comments on commit c7d55d8

Please sign in to comment.