nteract/testbook

Add support for SKIPPING cells' execution

オープン

#141 opened on 2022/04/14

 (3 件のコメント) (1 件のリアクション) (0 人の担当者)Python (38 件のフォーク)auto 404
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (435 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Hey, First, great open source project.

I suggest the following feature: Currently to execute the entire notebook we can do:

    def test_notebook(self):
        notebook_path = "fuse_examples/tutorials/hello_world/hello_world.ipynb"
        # Execute the whole notebook and save it as an object
        with testbook(notebook_path, execute=True, timeout=600) as tb:

Now, if we want to execute only the first cell, we shall do:

    def test_notebook(self):
        notebook_path = "fuse_examples/tutorials/hello_world/hello_world.ipynb"
        # Execute the whole notebook and save it as an object
        with testbook(notebook_path, execute=[0], timeout=600) as tb:

But what if we want to execute the entire notebook besides the first cell ??? Currently it has to be as follow:

    def test_notebook(self):
        NUM_OF_CELLS = 'some number'
        notebook_path = "fuse_examples/tutorials/hello_world/hello_world.ipynb"
        # Execute the whole notebook and save it as an object
        with testbook(notebook_path, execute=range(1, NUM_OF_CELLS + 1), timeout=600) as tb:

But A MUCH CLEANER APPROACH would be:

    def test_notebook(self):
        notebook_path = "fuse_examples/tutorials/hello_world/hello_world.ipynb"
        # Execute the whole notebook and save it as an object
        with testbook(notebook_path, skip=[0], timeout=600) as tb:

コントリビューターガイド