diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f2c5762..cb619ed3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,6 +89,7 @@ jobs: apk add gmp-dev curl jq libsodium-dev git xxd procps python3 -m venv tezos_test_env --system-site-package source ./tezos_test_env/bin/activate + python3 -m pip install --upgrade pip -q python3 -m pip install -r ./tests/requirements.txt -q TMP_DIR=$(mktemp -d /tmp/foo-XXXXXX) tar xfz app_${{ matrix.device }}_dbg.tgz -C $TMP_DIR @@ -192,6 +193,7 @@ jobs: apk add gmp-dev curl jq libsodium-dev git xxd procps python3 -m venv tezos_test_env --system-site-package source ./tezos_test_env/bin/activate + python3 -m pip install --upgrade pip -q python3 -m pip install -r ./tests/requirements.txt -q ./tests/integration/run_test_local.sh -T100 -F -m ${{ matrix.device }} tests diff --git a/.github/workflows/coding_style_checks.yml b/.github/workflows/coding_style_checks.yml index ac30e70c..a8ec73f9 100644 --- a/.github/workflows/coding_style_checks.yml +++ b/.github/workflows/coding_style_checks.yml @@ -23,3 +23,20 @@ jobs: source: './app/src' extensions: 'h,c' version: 15 + + pylint_check: + name: Python Lint Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install pylint + run: pip install pylint -r tests/requirements.txt + + - name: Run pylint with .pylintrc + run: pylint --errors-only --rcfile=tests/integration/.pylintrc tests/integration/nano/ diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 4c051d2f..863ce041 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,4 +12,4 @@ jobs: python-version: '3.10' - run: python -m pip install pre-commit - run: python -m pip freeze --local - - run: SKIP=clang-format pre-commit run --all-files + - run: SKIP=clang-format,pylint pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8675de0c..3d97c639 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,3 +19,12 @@ repos: language: system files: ^ types: [file, c] + + - id: pylint + name: pylint + description: Run pylint with custom .pylintrc configuration + entry: pylint + language: system + pass_filenames: false + args: ["--errors-only", "--rcfile=tests/integration/.pylintrc", "tests/integration/nano/"] + types: [python] diff --git a/Makefile b/Makefile index 695ccfd0..1e776f0b 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,7 @@ integration_tests_basic_%: app_%.tgz \ apk add gmp-dev curl jq libsodium-dev git xxd procps; \ python3 -m venv tezos_test_env --system-site-package; \ source ./tezos_test_env/bin/activate; \ + python3 -m pip install --upgrade pip -q; \ python3 -m pip install -r tests/requirements.txt -q ; \ python3 -m pytest -n 32 tests/integration/nano/ --tb=no \ --device $* --app \$$TMP_DIR/app.elf \ diff --git a/scripts/test_swap.sh b/scripts/test_swap.sh index c649edc8..cabcfb26 100755 --- a/scripts/test_swap.sh +++ b/scripts/test_swap.sh @@ -151,7 +151,8 @@ run_tests() { --rm -v "$(realpath .):/app" \ ledger-app-tezos-integration-tests -c \ "cd /app && \ - pip install -r test/python/requirements.txt -q && \ + pip install --upgrade pip -q && \ + pip install -r test/python/requirements.txt -q && \ pip install protobuf==3.20.3 && pytest test/python $*" ) } diff --git a/tests/integration/run_test_docker.sh b/tests/integration/run_test_docker.sh index cdb41f28..3a8ed0e5 100755 --- a/tests/integration/run_test_docker.sh +++ b/tests/integration/run_test_docker.sh @@ -33,5 +33,6 @@ docker run --rm -it -v "$(realpath .):/app" \ -c " apk add gmp-dev curl jq libsodium-dev git xxd procps; \ python3 -m venv tezos_test_env --system-site-package; \ source ./tezos_test_env/bin/activate; \ + python3 -m pip install --upgrade pip -q; \ python3 -m pip install -r tests/requirements.txt -q; \ ./tests/integration/run_test_local.sh -F -m $*" diff --git a/tests/requirements.txt b/tests/requirements.txt index 419eeb13..8621f945 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -6,3 +6,4 @@ base58 pytezos GitPython pytest-xdist +ragger[tests,speculos,ledgerwallet]