39 ms·
My favorite pytest trick: Using jupytext notebooks as tests. I always use a notebook for notes and experiments when building python packages. By using `jupytex
by japanuspus 4y ago
My favorite pytest trick: Using jupytext notebooks as tests.
I always use a notebook for notes and experiments when building python packages. By using `jupytext`[0] I can store the notebook as a commented python-file, which I can run from a parametrized test that runs all notebooks in a given folder [1].
Adding a few `asserts`, this gives you reasonable test coverage right from the start.
[0]: https://jupytext.readthedocs.io/en/latest/ https://jupytext.readthedocs.io/en/latest/
[1]: https://stackoverflow.com/a/56813896/212538 https://stackoverflow.com/a/56813896/212538