Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for jupyter notebook embeded tests #11466

Closed
ycopin opened this issue Sep 24, 2023 · 3 comments
Closed

Support for jupyter notebook embeded tests #11466

ycopin opened this issue Sep 24, 2023 · 3 comments

Comments

@ycopin
Copy link

ycopin commented Sep 24, 2023

Hi,
I'm a fairly naive user of pytest, mostly in some educational context. While it's easy to use doctest & unittest tests within a notebook (see e.g. this gist or my own user case, it seems impossible to do the same with pytest tests, without resorting to plugins or additional dependencies (e.g. ipytest).

I definitely don't know all the gory internal details of pytest, but I wonder why it's not possible to easily embed pytest tests within a notebook, so that I can illustrate different (easier to write) test methods?

What's the problem this feature will solve?

Embed and run pytest tests within a jupyter notebook.

Describe the solution you'd like

A few-line self-consistent solution as possible with unittest, see e.g. this notebook.

Alternative Solutions

The ipytest solution works fine (with extra features), but requires an extra-dependency. I'm looking for a minimal procedure, mostly to illustrate the writing of pytest tests.

@The-Compiler
Copy link
Member

Given that there is a project doing this already, and given how testing Jupyter notebooks is something rather exotic in the big picture... I really don't see why this would need to be part of the pytest core. What's the problem with an extra dependency, given that pytest (and Jupyter!) are already third-party packages anyways?

@RonnyPfannschmidt
Copy link
Member

Closing this as not a core responsibility

@RonnyPfannschmidt RonnyPfannschmidt closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2023
@ycopin
Copy link
Author

ycopin commented Sep 24, 2023

Point taken, I just wanted to be sure I did not overlook an easy way around. Regarding dependencies, adding new ones to a university system you're not controlling is not always an easy task. Jupyter and pytest are well identified, ipytest much less so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants