Ghostwriter Demo

Tired of writing tests? Hypothesis has you covered!


Test code

def test_loading_time_is_not_visible():
    assert False
Once you're done editing the test code,
============================= test session starts ==============================
platform emscripten -- Python 3.11.3, pytest-7.2.2, pluggy-1.2.0 -- /home/pyodide/this.program
cachedir: .pytest_cache
hypothesis profile 'browser' -> database=None, deadline=None, derandomize=True
rootdir: /home/pyodide
plugins: hypothesis-6.98.3
collecting ...

Wait, what?

It's an interactive demo for the Hypothesis Ghostwriter, a Python tool which helps you to get started with property-based testing. Thanks to Pyodide, we can run Python client-side to both generate and execute tests - and even pip install missing packages! If you're not sure how to get started, try the gzip.compress example and replacing data=st.nothing() with data=st.binary() to generate bytestrings.

Want to install Hypothesis locally? pip install "hypothesis[cli]" and you'll get the Python library and a hypothesis write command which can do all this and more. If you're already using Hypothesis, check out HypoFuzz: it's a world-class fuzzing workflow for your test suite.

back to homepage / forward to github