pytest needs to be installed on your system. Easily install it by installing the development dependencies.
$ python3 -m pip install .[dev]
pytest configuration is stored in
[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 file.
$ python3 -m pytest tests/test_math.py
Or only run a specific unit test.
$ python3 -m pytest tests/test_math.py::test_gcd
Run from VS Code¶
Included is a VS Code configuration file
.vscode/settings.json. This instructs VS Code about how to invoke
VS Code’s integrated test infrastructure will locate the tests and allow you to run or debug any test.
Test vectors are generated by third-party tools and stored in
.pkl files. Most test vectors are stored in these folders:
The scripts that generate the test vectors are:
$ sudo apt install sagemath
$ python3 -m pip install sympy
Generate test vectors¶
To re-generate the test vectors locally, run:
$ python3 scripts/generate_int_test_vectors.py $ python3 scripts/generate_field_test_vectors.py
The scripts use random number generator seeds to generate reproducible test vectors. To generate different test vectors, modify the seeds. It’s also easy to increase the number of test cases for any individual test.