The community member is seeking the best practices for running pytest tests within a Marimo notebook. They are unable to run pytest.main() within the notebook and running tests in the command line is also not working. The community members discuss potential approaches, such as using asserts in individual cells or embedding tests in functions and using pytest. One community member suggests using docstrings for testing and provides a link to an example notebook. However, there is no explicitly marked answer in the comments.
I was wondering what the best practices are related to pytest. I can't run pytest.main() within the marimo notebook (error); and running it in the command line is not working neither (I guess I would have to export it into a classical python file first. Is there a recommend best approach to run tests?
yes, I would like to add some asserts while developing but I am not sure how to run them; one approach is to have the assert in one cell, but I would like to embed them into a function and use pytest. Maybe it could be a widget (like Explore Variables) that would run pytest?