Installation
$ pip install nose-test-sets
Usage
To define your set of common tests, create a TestSetBuilder, and use add_test to add tests. Each test should accept the same name of arguments. Say you define some tests for an adder in the module adder_test_set:
from nose_test_sets import TestSetBuilder
test_set_builder = TestSetBuilder()
test = test_set_builder.add_test
@test
def adding_zero_to_zero_returns_zero(adder):
assert adder.add(0, 0) == 0
@test
def adding_one_to_two_returns_three(adder):
assert adder.add(1, 2) == 3
create = test_set_builder.create
To run the tests against a specific implementation, you create a set of tests using the create function that we defined above:
import adder_test_set
def _run_test_with_standard_adder(test_func):
adder = StandardAdder()
return test_func(adder)
StandardAdderTests = adder_test_set.create(
"StandardAdderTests",
_run_test_with_standard_adder
)
The first argument to create should be the name of the concrete test set. The second argument is a function that can run each of the test functions. In the example above, to run the tests in StandardAdderTests, nose-test-sets ends up calling _run_test_with_standard_adder(adding_zero_to_zero_returns_zero) and _run_test_with_standard_adder(adding_one_to_two_returns_three).
Metadata
Release files for nose-test-sets 0.2.1
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 | Actions |
|---|---|---|---|---|
| nose-test-sets-0.2.1.tar.gz | 1.4 kB | Without provenance | Details for nose-test-sets-0.2.1.tar.gz |
Release files / nose-test-sets-0.2.1.tar.gz
| Download URL | nose-test-sets-0.2.1.tar.gz |
|---|---|
| Size | 1.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c33257dabd07b42811b05a6349fcc60483b9694c3c54bcb45504785e4a1654e
|
|
BLAKE2b-256 checksum How to use checksums |
d058296511e2518f814892b0f1c8899141f09ea4798e9d4c4f4303bd64717325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for nose-test-sets 0.2.1
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.