Documents & Tests
This page describes solutions ice-learn adopts about documentation generation, unit tests and documentation-based test. Note that following commands should be executed in a poetry shell, or prepended by poetry run.
pytest
- We use
pytestfor unittesting. For example,
where -s will print outputs for failed tests.
- Run specific tests with
test_mod.py::TestClass:test_methodortest_mod.py::test_function.
- Option
-m slowwill run tests decorated with the@pytest.mark.slowdecorator.
- Option
-m "not slow"will run tests not decorated with the@pytest.mark.slowdecorator.
-
See more configurations in
pytest.ini. -
ice.llutil.testhas some extensions for conditional tests for conveniency.
xdoctest
We use xdoctest for testing demostration code in docstring. For example,
or
lazydocs
We generate markdown documentations from docstring using a modified lazydocs script. For example,
mkdocs
We generate the documents site from manually written as well as autogenerated markdown using mkdocs, the plugin mkdocs-awesome-pages and the theme mkdocs-material. In the ./docs directory, files in documents are automatically generated by lazydocs, while other subfolders contain manually written docs.
Configuration file is mkdocs.yml. Changing the navigator appearance of the document site requires modifying .pages file in each level of subdirectories.
Run following command locally to preview the site at the root directory of ice-learn project:
Run following command to push documents to gh-pages branch (for Github Pages).
See this page for more infomation on deploying documents.