Closed Antonyjin closed 3 months ago
Deployed (not pinned) on:
I tried to launch this with pytest
, the test was skipped with the following message:
(aleph-docs) pytest -vv
=============================================================================================================================== test session starts ================================================================================================================================
platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0 -- /opt/venv/aleph-docs/bin/python
cachedir: .pytest_cache
rootdir: /home/sepal/Repos/aleph-im/aleph-docs
collected 1 item
docs/test/python_test.py::test_run_python_code[NotSetType.token] SKIPPED (got empty parameter set ['fpath'], function test_run_python_code at /home/sepal/Repos/aleph-im/aleph-docs/docs/test/python_test.py:5)
Why put the tests in the /docs
directory ?
I tried to launch this with
pytest
, the test was skipped with the following message:(aleph-docs) pytest -vv =============================================================================================================================== test session starts ================================================================================================================================ platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0 -- /opt/venv/aleph-docs/bin/python cachedir: .pytest_cache rootdir: /home/sepal/Repos/aleph-im/aleph-docs collected 1 item docs/test/python_test.py::test_run_python_code[NotSetType.token] SKIPPED (got empty parameter set ['fpath'], function test_run_python_code at /home/sepal/Repos/aleph-im/aleph-docs/docs/test/python_test.py:5)
You have to be inside the directory and then run the pytest command
Why put the tests in the
/docs
directory ?
I put it there because I thought that these tests were part of the documentation tests but indeed on looking again, it's true that I find it more relevant to just put it at the root.
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
This is lacking one thing (that may need to be updated once https://github.com/aleph-im/aleph-docs/pull/79) : it does not actually run pytest in the CI.
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
See my suggestions on top of this branch: https://github.com/aleph-im/aleph-docs/pull/81
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
Deployed (not pinned) on:
We've given users plenty of examples so they can try out different functions on their own. The problem is that we may have written some code that doesn't work at all.
Solution: use mktestdocs to test blocks of python code I wrote a file located in /docs/test/ named python_test.py The script will go to the destination path I've specified and test every block of code that starts with '''python. This also means that if I've written code in python but it's not intended to be executed, it's possible to put only '''py, so that the code looks nice and well-formed but is not tested by mktestdocs.
To test locally, use the command below in /docs/test: pytest python_test.py::test_run_python_code
TO DO: Create a github action to test before building the documentation.