nose-picker
nose-picker is a plugin that picks a subset of your unit tests (in django too!)
This plugin modifies nose’s unit test discovery to only pick a (1/N) subset of unit tests to run. By passing in the --total-processes arguments, you pick the denominator (the N above) which you want to run. The --which-process argument controls which part of that subset to run, so if you had 5 subsets you could pick 0, 1, 2, 3, or 4.
How does it work? Very simple! It hashes the filenames that nose is running through, does a modulo division by N, then sees if this file is “its”. Very simple, but it lets you run multiple of these nose-picker enabled runners in parallel, each running a separate subset of the unit tests!
Motivation
The nose multiprocess plugin takes over the test runner when it runs, and thus is not amenable to environments where you need a custom test runner. nose-picker lets you keep your test runner!
Installing
Through pip:
pip install --user nose-picker
Sample Multiprocess Script
Something like:
def main():
num_processes = int(multiprocessing.cpu_count() * 2.5)
tests = []
for i in range(num_processes):
test_command = TEST_CMD_TEMPLATE % (
i,
num_processes,
)
tests.append(TestWatcher(test_command))
returncode = 0
for test_watcher in tests:
test_watcher.join()
if test_watcher.returncode > 0:
returncode += test_watcher.returncode
for line in test_watcher.stderr.splitlines():
if not (
line.endswith(' ... ok') or
'... SKIP' in line
):
sys.stderr.write(line + '\n')
return returncode
class TestWatcher(threading.Thread):
def __init__(self, command):
super(TestWatcher, self).__init__()
self.command = command
self.stdout = ''
self.stderr = ''
self.start()
self.returncode = 0
def run(self):
p = subprocess.Popen(
self.command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
self.stdout, self.stderr = p.communicate()
self.returncode = p.returncode
License
nose-picker is copyright 2014 Eventbrite and Contributors, and is made available under BSD-style license; see LICENSE for details.
Metadata
Release files for nose-picker 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nose-picker-0.5.6.tar.gz | 5.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nose_picker-0.5.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / nose-picker-0.5.6.tar.gz
| Download URL | nose-picker-0.5.6.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a2b4bb0f8641aabfe9fb41270aa4ff540ad4b11edb2d050f9ea2d0bb6fcc0e6
|
|
BLAKE2b-256 checksum How to use checksums |
1f3eaadcfec57c6efacf0c07e8ec84f2849490e74457da96a1e555b05acf3984
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
|
Release files / nose_picker-0.5.6-py2.py3-none-any.whl
| Download URL | nose_picker-0.5.6-py2.py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6bec26cc5b8bbf19146e6618d38f53b5a0f2a7a382799283522d1fb7f7a76f56
|
|
BLAKE2b-256 checksum How to use checksums |
d23f7cae3a67cdf75e31a493ad08852aaac450ae5028778c87309f241e8129b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
|
Security for nose-picker 0.5.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.