Skip to main content

ExploTest

ExploTest is a tool that turns exploratory test runs into unit tests by capturing and serializing run-time arguments. By adding the @explore decorator to any function, ExploTest automatically generates unit tests with assertions based on the previous execution values.

Installation

pip install ExploTest

Local Installation

python3 -m pip install -e <path/to/explotest>

Usage

On any function or method (except for closures), add the @explore decorator. When this function (the function-under-test or FUT) is called at runtime, a unit test will be generated and saved in same directory as the file of the FUT.

The @explore decorator accepts two optional parameters, mode and explicit_record.

Configuration

mode determines how the run-time arguments are reconstructed in the unit test:

  • Setting this to "p" or "pickle" results in ExploTest "pickling" (a Python specific binary serialization) each argument into a file, then loading this file in the unit test. ExploTest uses the dill library for pickling, which enables support for function arguments among others. However, objects that cannot be pickled ( e.g., Pandas DataFrames) cannot be saved. This is the default behaviour.
  • Setting this to "a" results in ExploTest attempting to reconstruct the parameter by creating a new object and setting all its fields to the runtime argument. For example, when running the code
class Bar:
    x = 1


@explore(mode="a")
def baz(b):
    return


baz(Bar())

the unit test

@pytest.fixture
def generate_b():
    clone_b = scratchpad.Bar.__new__(scratchpad.Bar)
    setattr(clone_b, 'x', 1)
    return clone_b


def test_baz(generate_b):
    b = generate_b
    return_value = scratchpad.baz(b)
    assert return_value is None

is generated. This will not work for some objects, namely ones that are "more" than just a collection of fields or have fields that cannot be setattr'd. In this case, ExploTest will try to fall back on pickling.

explicit_record determines when ExploTest generates a unit test. By default, this is False and so ExploTest generates a unit test everytime a function with the @explore decorator is called. However, this may become unwieldy if the function is called many times and only certain tests are desired. By setting explicit_record to True in a function, a unit test will only be created if the function body calls explotest_record(). Note that due to implementation details, this is not thread safe.

For example,

@explore(explicit_record=True)
def fib(n):
    if n <= 1:
        explotest_record()
        return 1
    return fib(n - 1) + fib(n - 2)

A unit test will only be generated for when n <= 1.

Development Setup

Create a venv, then install pip-tools. Run pip-compile as specified.

python3 -m venv .venv
pip install pip-tools
pip-compile -o requirements.txt ./pyproject.toml
pip install -r requirements.txt

ExploTest is free and open source software, licensed under the GNU LGPL v3 or any later version.

Metadata

Release files for ExploTest 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ExploTest 1.0.4
File Size Uploaded
explotest-1.0.4.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ExploTest 1.0.4
File Interpreter ABI Platform
explotest-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / explotest-1.0.4.tar.gz

Download URL explotest-1.0.4.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60cf096d8ef8a47418ddcce7dcefffee1eea67b855414ca7a78d4c637a6ed56b
BLAKE2b-256 checksum
How to use checksums
ca909bf982821c76ed865ab2ecac1f01b1d86d65a5dfe36362bfacfad425a49a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.

Transparency log

Release files / explotest-1.0.4-py3-none-any.whl

Download URL explotest-1.0.4-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8b8f0d69716dfe8ab9866a718f8ded7338420ba48e26f8655d0807a0b3755af
BLAKE2b-256 checksum
How to use checksums
78416b1dfc37ef5c9a2e2446821199dcce9a59fd3a83ef9007433698842bfe96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page