Skip to main content

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

from nose_test_sets import TestSetBuilder

test_set_builder = TestSetBuilder()

@test_set_builder.add_test
def adding_zero_to_zero_returns_zero(adder):
    assert adder.add(0, 0) == 0

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 contextlib

import adder_tests

@contextlib.contextmanager
def create_adder():
    return StandardAdder()

StandardAdder = adder_tests.create("StandardAdder", create_adder)

The first argument to create should be the name of the concrete test set. Any further arguments should be context managers that supply the arguments that will be used by each test.

Download files

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

Source Distribution

nose-test-sets-0.2.0.tar.gz (1.3 kB view details)

Uploaded Source

File details

Details for the file nose-test-sets-0.2.0.tar.gz.

File metadata

File hashes

Hashes for nose-test-sets-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c863ca89dfef6efa447aa71219767422b4b7059d4d5a085f50a116e743669890
MD5 8d86816e006db2a7c1c0cf71f6a9d453
BLAKE2b-256 7a50d50aacdf0210eae6286023d9fd54a6f4181914a2f33ffe533f5edefda3c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page