:\ >Aggelos Arelakis

tINI-test

A zero-dependency Python test framework with test discovery, mocking, isolation and coverage reporting, published on PyPI.

The problem

I wanted a small, type-safe test runner with no third-party dependencies that still covers the features real projects need: mocks, shared state, isolation and coverage.

What I built

  • Test cases are declared with @Test.case decorators, with optional setup and cleanup.
  • Mocks for functions, classes and even built-ins, via @Mock.mock or the stackable Mock.mocking context manager.
  • @Shared context variables, @Isolate for test isolation and a WillRaise context manager for exception checks.
  • Coverage runs, including on top of a running server, with HTML reports and an SVG badge.
  • The framework tests itself: about 5k base tests, and it was stress tested and profiled on around 10k tests using temporary SQLite databases.