Skip to main content

Run tests in parallel with free threading

Project description

unittest-ft

Run Python tests in parallel with free threading

version 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

$ pip install unittest-ft

Usage

Run your test suite:

$ 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:

$ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unittest_ft-0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

unittest_ft-0.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file unittest_ft-0.3.tar.gz.

File metadata

  • Download URL: unittest_ft-0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for unittest_ft-0.3.tar.gz
Algorithm Hash digest
SHA256 e49928f2284875db0099c7afdb3585747a0cab93b46995b5314f94f10eb9c5e6
MD5 edb9fb7fc22d61e16d1f99f719cc2462
BLAKE2b-256 0bdc2b09051738580a93d1190604e20eaf7644f3049db2ed643c8c55dbb38a11

See more details on using hashes here.

File details

Details for the file unittest_ft-0.3-py3-none-any.whl.

File metadata

  • Download URL: unittest_ft-0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for unittest_ft-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 370187ce34383952ba0117f9a39ce627cd23ee5b13f32901ed62e48fa8f9ef6e
MD5 1f791f8a5444baaa9c21258064209476
BLAKE2b-256 1b6f893d7bab44adecaaf0e32ffc02a11164869aa2b46c9d2ff8dc0efbf95e14

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page