Metadata-Version: 2.4
Name: unittest-ft
Version: 0.4
Summary: Run tests in parallel with free threading
Author-email: Amethyst Reese <amethyst@n7.gg>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Testing
License-File: LICENSE
Requires-Dist: click >= 8
Requires-Dist: typing-extensions >= 4.8.0
Requires-Dist: attribution>=1.8 ; extra == "dev"
Requires-Dist: black==25.1.0 ; extra == "dev"
Requires-Dist: build>=1.2 ; extra == "dev"
Requires-Dist: flake8==7.2.0 ; extra == "dev"
Requires-Dist: mypy==1.15.0 ; extra == "dev"
Requires-Dist: ufmt==2.8.0 ; extra == "dev"
Requires-Dist: usort==1.0.8.post1 ; extra == "dev"
Project-URL: Home, https://github.com/amyreese/unittest-ft
Provides-Extra: dev

# unittest-ft

Run Python tests in parallel with free threading

[![version](https://img.shields.io/pypi/v/unittest-ft.svg)](https://pypi.org/project/unittest-ft)
[![license](https://img.shields.io/pypi/l/unittest-ft.svg)](https://github.com/amyreese/unittest-ft/blob/main/LICENSE)

Alternative to the standard unittest runner that spawns a thread pool, and
runs every test individually on separate threads, in parallel, to both run tests
faster and to assist with validating the thread safety of the tested system.

unittest-ft also includes options to run "stress tests" which queues every test
to be run ten times rather than just once, as well as randomizing the test order
every time to help catch unintended test order dependencies.

This is intended for use with Python 3.13 or newer with Free Threading enabled,
but is functionally compatible back to Python 3.8 for use in multi-version CI.


Install
-------

```shell-session
$ pip install unittest-ft
```


Usage
-----

Run your test suite:

```shell-session
$ unittest-ft [<module>]
s...xx.
----------------------------------------------------------------------
Ran 7 tests in 463.69ms

OK (skipped=1, expected failures=2)
```

If you can spare the time/cores, run a randomized stress test:

```shell-session
$ unittest-ft --randomize --stress-test [<module>]
.s...xs.xsxx.xx....xxx..xsxx.x.s.x...xs.xsxx....xx...s..ss............
----------------------------------------------------------------------
Ran 70 tests in 1.240s (saved 9.988s)

OK (skipped=10, expected failures=20)
```


License
-------

unittest-ft is copyright Amethyst Reese, and licensed under the MIT license.

