Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Add automated testing for Jupyter notebooks#220

Description

@Artemon-line

馃殌 The feature, motivation and pitch

Overview

Automate testing for notebooks in examples/notebooks/ to ensure they remain executable and up-to-date.

Current Notebooks

  • Cybersecurity_demo.ipynb
  • LlamaGuard.ipynb
  • LlamaGuardMM.ipynb

Recommended Approach

Use nbmake for execution testing + testbook for detailed unit tests.

nbmake (execution testing)

pytest --nbmake examples/notebooks/*.ipynb                                                                                                                  

testbook (unit testing)

  @testbook('examples/notebooks/LlamaGuard.ipynb', execute=True)                                                                                              
  def test_llamaguard_notebook(tb):                                                                                                                           
      tb.execute_cell([0, 1, 2])                                                                                                                              
      assert tb.ref('some_variable') is not None                                                                                                              

Dependencies to Add

nbmake>=1.4.0
testbook>=0.4.2
jupyter>=1.0.0

Implementation Notes

  • Mock external API calls
  • Set appropriate cell timeouts
  • Create fixtures for common test data
  • Configure in pytest.ini

Success Criteria

  • Dependencies added
  • All notebooks execute successfully
  • Test configuration in pytest.ini
  • Mock fixtures for external dependencies
  • Documentation updated

Alternatives

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions