--- id: ipytest version: "0.14.2" license: MIT license_treatment: permissive maintenance: dormant --- # ipytest — Unit tests in IPython notebooks License: permissive · Maintenance: dormant · Downloads: 77.5K/mo ## What it is and what it does ipytest bridges pytest and Jupyter notebooks, letting you write and run unit tests interactively without leaving the notebook environment. It registers pytest's assertion rewriter with IPython for better error messages, handles the notebook-to-module mapping pytest needs, and cleans up test state between cell executions to avoid stale test definitions. The package depends on ipython, packaging, and pytest. It's designed to make it easy to prototype tests in notebooks and later move them to separate test files. It handles common notebook gotchas like module caching and async event loop interference, offering options like force_reload() and run_in_thread mode to work around them. Use it for: - Prototyping unit tests interactively in a notebook before moving them to a dedicated test file. - Teaching or documenting code behavior by writing and running tests inline with explanatory text. - Testing data science or analysis code iteratively without switching between notebook and terminal. - Debugging test failures by running pytest with full notebook context and repl access. - Validating module behavior during development when using IPython's autoreload extension. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Runs pytest test suites directly in Jupyter notebooks with full pytest functionality, including assertion rewriting and test discovery. Yes, if you work in Jupyter notebooks and want to run pytest without leaving the environment. The package is stable, has no known vulnerabilities, and low install friction. The 845-day dormancy is a minor concern but not a blocker for a mature, narrow-scope tool. Install it if interactive testing in notebooks fits your workflow; skip it if you already run tests in a separate CI/test runner. ## Install pip install ipytest uv add ipytest poetry add ipytest ## Installing ipytest Before you install: Low install friction with a pure-Python wheel. Maintenance is dormant (845 days since last release), but the package is stable and supports current Python versions (3.8–3.12). License in practice: MIT license is permissive; you can use, modify, and distribute ipytest freely in commercial and private projects with minimal restrictions. Quickstart: pip install ipytest import ipytest ipytest.autoconfig() # In a new cell: %%ipytest -qq def test_example(): assert [1, 2, 3] == [1, 2, 3] Requires IPython/Jupyter notebook environment; some notebook implementations may not support magics correctly, in which case ipytest.run() and ipytest.clean() can be used directly. Verify before relying: - Whether the 845-day dormancy affects compatibility with the latest Jupyter/IPython releases. - Performance impact when running large test suites in notebooks with the assertion rewriter enabled globally. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 77.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest in jupyter notebooks, unit testing jupyter, ipython notebook testing, run tests in notebook, jupyter test runner, notebook pytest integration, interactive test execution, jupyter-integration, interactive-testing [View on SkillFed](https://skillfed.io/packages/ipytest) · [View on PyPI](https://pypi.org/project/ipytest/)