Skip to content

Commit

Permalink
Add the bitcoin_client to the requirements.txt for the test suites, i…
Browse files Browse the repository at this point in the history
…nstead of modifying the system PATH
  • Loading branch information
bigspider committed Dec 17, 2024
1 parent 24bcdae commit bf12689
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 62 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,13 @@ jobs:
name: bitcoin-app-${{matrix.model}}
path: bin

- name: Install build dependencies
run: apt update && apt install -y build-essential

- name: Run tests
run: |
cd tests_mainnet
pip install -r requirements.txt
cd tests_mainnet
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300
job_test_python_lib_legacyapp:
Expand All @@ -182,10 +185,13 @@ jobs:
- name: Clone
uses: actions/checkout@v4

- name: Install build dependencies
run: apt update && apt install -y build-essential

- name: Run tests
run: |
cd bitcoin_client/tests
pip install -r requirements.txt
cd bitcoin_client/tests
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 --model=nanos
job_perftests:
Expand Down Expand Up @@ -215,10 +221,13 @@ jobs:
name: bitcoin-testnet-perftest-app-nanosp
path: bin

- name: Install build dependencies
run: apt update && apt install -y build-essential

- name: Run tests
run: |
cd tests_perf
pip install -r requirements.txt
cd tests_perf
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=nanosp --benchmark-json=benchmarks.json
- name: Upload benchmarks summary
uses: actions/upload-artifact@v4
Expand Down
9 changes: 0 additions & 9 deletions bitcoin_client/tests/requirements.txt

This file was deleted.

14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# requirements for the various test suites

pytest>=6.1.1,<7.0.0
pytest-benchmark>=4.0.0,<5.0.0
pytest-timeout>=2.1.0,<3.0.0
ledgercomm>=1.1.0,<1.2.0
ecdsa>=0.16.1,<0.17.0
typing-extensions>=3.7,<4.0
embit>=0.7.0,<0.8.0
mnemonic==0.20
bip32>=3.4,<4.0
speculos>=0.12.0,<0.13.0
ragger[speculos, ledgerwallet]>=1.6.0
-e ./bitcoin_client # path relative to the current working directory; assume it's the root of the repo
2 changes: 0 additions & 2 deletions test_utils/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ These tests are implemented in Python and can be executed either using the [Spec

All the commands in this folder are meant to be ran from the `tests` folder, not from the root.

Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/)
Python dependencies are listed in [requirements.txt](../requirements.txt), install them using [pip](https://pypi.org/project/pip/) from the root of the repository:

```
pip install -r requirements.txt
Expand Down
9 changes: 1 addition & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@

import sys # noqa: E402
import os # noqa: E402

absolute_path = os.path.dirname(os.path.abspath(__file__)) # noqa: E402
relative_bitcoin_path = ('../bitcoin_client') # noqa: E402
absolute_bitcoin_client_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '../') # noqa: E402
sys.path.append(os.path.join(absolute_path, relative_bitcoin_path)) # noqa: E402
import os

from ragger_bitcoin import createRaggerClient, RaggerClient
from ragger.backend import RaisePolicy
Expand Down
12 changes: 2 additions & 10 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
pytest>=6.1.1,<7.0.0
pytest-timeout>=2.1.0,<3.0.0
ledgercomm>=1.1.0,<1.2.0
ecdsa>=0.16.1,<0.17.0
typing-extensions>=3.7,<4.0
embit>=0.7.0,<0.8.0
mnemonic==0.20
bip32>=3.4,<4.0
speculos>=0.12.0,<0.13.0
ragger[speculos, ledgerwallet]>=1.6.0
# The reusable ragger workflow expects a requirements.txt file in the tests directory, but we want to just use the one in the repository's root.
-r ../requirements.txt
2 changes: 1 addition & 1 deletion tests_mainnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ These tests are implemented in Python and can be executed either using the [Spec

All the commands in this folder are meant to be ran from the `tests` folder, not from the root.

Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/)
Python dependencies are listed in [requirements.txt](../requirements.txt), install them using [pip](https://pypi.org/project/pip/) from the root of the repository:

```
pip install -r requirements.txt
Expand Down
9 changes: 0 additions & 9 deletions tests_mainnet/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests_perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The tests in this folder are meant to measure the performance of various app ope

These tests are implemented in Python and can be executed either using the [Speculos](https://github.com/LedgerHQ/speculos) emulator or a Ledger Nano S+, Nano X, or Stax.

Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/)
Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/) from the root of the repository:

```
pip install -r requirements.txt
Expand Down
10 changes: 0 additions & 10 deletions tests_perf/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
from pathlib import Path
from test_utils.fixtures import *
import random
import sys
import os

absolute_path = os.path.dirname(os.path.abspath(__file__))
relative_bitcoin_path = ('../bitcoin_client')
absolute_bitcoin_client_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '../')
sys.path.append(os.path.join(absolute_path, relative_bitcoin_path))

from ledger_bitcoin import Chain # noqa: E402

TESTS_ROOT_DIR = Path(__file__).parent

Expand Down
8 changes: 0 additions & 8 deletions tests_perf/requirements.txt

This file was deleted.

0 comments on commit bf12689

Please sign in to comment.