https://github.com/amyreese/unittest-ft
Run Python tests in parallel with free threading
https://github.com/amyreese/unittest-ft
free-threading hacktoberfest nogil python testing unittest
Last synced: 29 days ago
JSON representation
Run Python tests in parallel with free threading
- Host: GitHub
- URL: https://github.com/amyreese/unittest-ft
- Owner: amyreese
- License: mit
- Created: 2024-10-05T01:36:12.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-04-17T01:18:37.000Z (about 1 month ago)
- Last Synced: 2025-04-17T11:30:01.061Z (about 1 month ago)
- Topics: free-threading, hacktoberfest, nogil, python, testing, unittest
- Language: Python
- Homepage:
- Size: 47.9 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# unittest-ft
Run Python tests in parallel with free threading
[](https://pypi.org/project/unittest-ft)
[](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 []
s...xx.
----------------------------------------------------------------------
Ran 7 tests in 463.69msOK (skipped=1, expected failures=2)
```If you can spare the time/cores, run a randomized stress test:
```shell-session
$ unittest-ft --randomize --stress-test []
.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.