Closed furechan closed 2 years ago
Hi @furechan, this should be possible using pytest arguments.
Can you try
pytest --nbmake my_dir
I recommend checking out pytest docs as there are lots of options for selecting which tests to run.
hi @alex-treeboard,
Yes it is possible to specify folders like you suggest.
Say you have your test files in ./tests and your test notebooks in ./nbtests the following works and collects pure tests as well as notebooks tests.
pytest --nbmake tests nbtests
This works if all test notebooks have been segregated in a dedicated folder which I guess is a reasonable requirement.
Thanks
It is possible to run
pytest --nbmake
in a project folder to collect tests both as .py files and .ipynb files. This however will collect all notebooks in the tree. In my projects there are notebooks for different purposes and some are for testing only. It would be nice to have an option to specify the pattern of notebooks to include in the tests (say "test-*.ipynb"). This option ideally could be set in the pyproject.toml file. So that one can runpytest --nbmake
in any project and be sure to pick all relevant tests be it python or notebook.