Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.13 KB

File metadata and controls

42 lines (31 loc) · 1.13 KB

Testing

Directory Structure

  • Snapshots: Store in snapshots/ directory next to your test file
  • Fixtures: Store test input files in fixtures/ directory next to your test file
tests/_convert/ipynb/
├── test_ipynb_converter.py
├── snapshots/          # Expected outputs
└── fixtures/           # Test inputs

Snapshot Testing

from tests.mocks import snapshotter

snapshot = snapshotter(__file__)
snapshot("output.py.txt", result)  # Auto-creates/compares snapshot

Kernel Fixtures

Available in tests/conftest.py:

  • k - Default kernel (autorun, relaxed)
  • strict_kernel - Strict execution mode
  • lazy_kernel - Lazy execution mode
  • run_mode_kernel - RUN mode (not EDIT)
  • mocked_kernel - Full MockedKernel wrapper
  • executing_kernel - Execution context installed
  • any_kernel - Parametrized: runs test 3x (k, strict, lazy)
  • execution_kernel - Parametrized: runs test 2x (k, strict)

Running Tests

uv run --python 3.12 --group test pytest tests/path/to/test.py
uv run --python 3.12 --group test-optional pytest tests/path/to/test.py  # with optional deps