2022-04-08 09:57:12 +02:00
# Speculos functional tests
These tests are implemented in Python with the `SpeculosClient` interface which allows easy execution on the [Speculos ](https://github.com/LedgerHQ/speculos ) emulator.
## Requirements
- [python >= 3.8 ](https://www.python.org/downloads/ )
- [pip ](https://pip.pypa.io/en/stable/installation/ )
### Dependencies
Python dependencies are listed in [requirements.txt ](requirements.txt )
```shell
python3 -m pip install --extra-index-url https://test.pypi.org/simple/ -r requirements.txt
```
> The extra index allows to fetch the latest version of Speculos.
## Usage
2022-07-04 13:52:18 +02:00
### Compilation app
2022-04-08 09:57:12 +02:00
2022-07-04 13:52:18 +02:00
Go to the root of the repository:
```sh
make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOX_SDK
2022-07-25 10:39:42 +02:00
mv bin/app.elf tests/speculos/<some name>.elf
2022-04-08 09:57:12 +02:00
```
2022-07-04 13:52:18 +02:00
Given the requirements are installed, just do (by default command):
```
cd tests/speculos/
pytest
2022-04-08 09:57:12 +02:00
```
2022-07-04 13:52:18 +02:00
### Custom options
- **--model:** "nanos", "nanox", "nanosp" | default: "nanos"
- **--display:** "qt", "headless" | default: "qt"
- **--path:** the path of the binary app | default: path of makefile compilation
## Example
With `nanox` binary app:
```sh
# the --path is variable to where you put your binary
2022-04-08 09:57:12 +02:00
2022-07-04 13:52:18 +02:00
pytest --model nanox --path ./elfs/nanox.elf
2022-04-08 09:57:12 +02:00
2022-07-04 13:52:18 +02:00
# Execute specific test:
pytest --model nanox --path ./elfs/nanox.elf test_pubkey_cmd.py
```