Skip to content

Commit

Permalink
Merge pull request #738 from LedgerHQ/fbe/use_ragger_setup_feature
Browse files Browse the repository at this point in the history
Use new setup feature from ragger
  • Loading branch information
fbeutin-ledger authored Feb 21, 2025
2 parents d456661 + da965f5 commit c6bea2e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ jobs:
download_app_binaries_artifact: "ragger_elfs"
additional_app_binaries_artifact: "clone_elfs"
additional_app_binaries_artifact_dir: ./tests/ragger/.test_dependencies/clone/build/
test_options: "--with_lib_mode"
test_options: "--setup lib_mode"
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
testpaths = tests/ragger
pythonpath = tests/ragger
addopts = tests/ragger
31 changes: 6 additions & 25 deletions tests/ragger/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,14 @@
# ragger.configuration.OPTIONAL_CONFIGURATION
# Please refer to ragger/conftest/configuration.py for their descriptions and accepted values

configuration.OPTIONAL.ALLOWED_SETUPS = ["default", "lib_mode"]

def pytest_addoption(parser):
parser.addoption("--with_lib_mode", action="store_true", help="Run the test with Library Mode")


pattern = f"{Path(__file__).parent}/test_*.py"
testFiles = [path.basename(x) for x in glob.glob(pattern)]
collect_ignore = []
if "--with_lib_mode" in sys.argv:

# ==============================================================================
# /!\ Tests are started in Library mode: unselect (ignore) unrelated modules /!\
# ==============================================================================

warnings.warn("Main app is started in library mode")

configuration.OPTIONAL.MAIN_APP_DIR = "tests/ragger/.test_dependencies/"

collect_ignore += [f for f in testFiles if "test_clone" not in f]

else:

# ===========================================================================
# /!\ Standards tests without Library mode: unselect (ignore) clone tests /!\
# ===========================================================================

collect_ignore += [f for f in testFiles if "test_clone" in f]
def pytest_configure(config):
current_setup = config.getoption("--setup")
if current_setup == "lib_mode":
warnings.warn("Main app is started in library mode")
configuration.OPTIONAL.MAIN_APP_DIR = "tests/ragger/.test_dependencies/"


@pytest.fixture(name="app_version")
Expand Down
3 changes: 3 additions & 0 deletions tests/ragger/test_clone.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from pathlib import Path
from web3 import Web3

Expand All @@ -19,6 +21,7 @@


# Transfer on Clone app
@pytest.mark.needs_setup('lib_mode')
def test_clone_thundercore(firmware: Firmware,
backend: BackendInterface,
navigator: Navigator,
Expand Down

0 comments on commit c6bea2e

Please sign in to comment.