Running the test suite#
Pytest#
If you want to run the pytest test suite, first install pytest. The easiest way to do this is by following Project setup. Then, run the command:
pytest
or, for more detail,
pytest -v
A fully passing test suite should look something like this:
====================== test session starts ========================
platform linux -- Python 3.12.7, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/louie/dev/upd/cs11-mp/eggdrop
configfile: pyproject.toml
collected 55 items
src/tests/test_end_to_end.py .. [ 3%]
src/tests/test_move_history.py ......... [ 20%]
src/tests/test_movement.py ........................ [ 63%]
src/tests/test_points.py .................... [100%]
===================== 55 passed in 0.88s =========================
The tests currently implemented include tests for movement with all kinds of different grid sizes and obstacles, tests for storing move history, tests for earning points (nests and pans), as well as some end-to-end tests for ensuring that animations are displayed correctly as well as recording moves and points.
To add new tests, you can either edit the existing files in the tests
subdirectory, or add a new file test_(name).py. Follow the
pytest documentation for more
details.
Pyright#
eggdrop is written using type hints and is configured to use pyright “strict” mode type-checking.
Note that only the base implementation is type-checked. The bonus features are not fully type hinted.
To run type checking, first install pyright either via Project setup (recommended) or the official docs. Then, run the command:
pyright
A successful run should yield no errors, for example:
❯ pyright
0 errors, 0 warnings, 0 informations
For more information, you can also run pyright in verbose mode:
pyright --verbose