For running snippets, have you read and tried what I outline in Feature Request - Ability to Split and Independently Execute Sections of a Single Cell - #2 by fomightez ?
pytest works with Jupyter otherwise and so I think this will work. However, without examples (which can be toy examples) and specifics it is hard to guide you further.
See also:
- python - Running pytest test functions inside a jupyter notebook - Stack Overflow
- python - Using pytest to test classes and functions in Jupyter Notebook Files - Stack Overflow (especially this comment in reply)
- example of pytest working in a notebook in ‘Learn Python 3’ notebooks
- Unit testing Python code in Jupyter notebooks (some toy code related to that, which you might find handy to adapt, is provided in this SO post)