Skip to content
New issue

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

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

Already on GitHub? # to your account

Support for in-kernel patching? #26

Open
cpascual opened this issue Jun 30, 2022 · 1 comment
Open

Support for in-kernel patching? #26

cpascual opened this issue Jun 30, 2022 · 1 comment

Comments

@cpascual
Copy link

In some of my notebooks, a given function call takes long time to return, making tests unpractical.
That is why I would like to be able to patch that function in the kernel with a mock.

I tried using the hooks provided by nbclient: on_notebook_start, etc. but they are not run in the kernel and therefore I cannot patch stuff there.

Is there some way of running code in the kernel prior to executing a notebook?

Alternatively: I see that testbook supports in-kernel patching. Since both testbook's TestbookNotebookClient and pytest_notebook's CoverageNotebookClient inherit from nbclient's NotebookClient, do you think that pytest-notebook could "borrow" the implementation from TestbookNotebookClient?

@amotl
Copy link
Contributor

amotl commented Feb 5, 2024

Hi. We also used testbook the other day, for the same reasons to run a few lines of in-kernel patching.

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

No branches or pull requests

2 participants