Unit Tests

The sdr library uses pytest for unit testing.

Install

First, pytest needs to be installed on your system. Easily install it by installing the development dependencies.

$ python3 -m pip install -r requirements-dev.txt

Configuration

The pytest configuration is stored in pyproject.toml.

pyproject.toml
[tool.pytest.ini_options]
minversion = "6.2"
addopts = "-s --showlocals"
testpaths = ["tests"]

Run from the command line

Execute all of the unit tests manually from the command line.

$ python3 -m pytest tests/

Or only run a specific test module.

$ python3 -m pytest tests/modulation/

Or only run a specific unit test file.

$ python3 -m pytest tests/modulation/test_psk.py

Run from VS Code

Included is a VS Code configuration file .vscode/settings.json. This instructs VS Code about how to invoke pytest. VS Code’s integrated test infrastructure will locate the tests and allow you to run or debug any test.


Last update: Oct 25, 2023