Skip to main content

nose extension for supporting parametrized testing

Project description

Allows developer to run the same test over and over again using different values

Main Features:
  • Very easy to integrate with existing tests

  • Saves a lot of boilerplate code, and code replication

  • Work with all nose plugins (including multiprocessing)

Installation:

pip install nose_ittr

Basic usage:

from nose.tools import assert_equal
from nose_ittr import IttrMultiplayer, ittr

class TestFoo(object):

    __metaclass__ = IttrMultiplayer

    def setup(self):
        pass

    def teardown(self):
        pass

    @ittr(number=[1, 2, 3, 4])
    def test_even(self):
        assert_equal(self.number % 2, 0)

    @ittr(numerator=[15, 6], denominator=[2, 3])
    def test_no_remainder(self):
        assert_equal(self.numerator % self.denominator, 0)

result:

TestFoo.test_even_1 ... FAIL
TestFoo.test_even_2 ... .ok
TestFoo.test_even_3 ... FAIL
TestFoo.test_even_4 ... .ok
TestFoo.test_no_remainder_2_6 ... .ok
TestFoo.test_no_remainder_2_15 ... FAIL
TestFoo.test_no_remainder_3_6 ... .ok
TestFoo.test_no_remainder_3_15 ... .ok
Notes:
  • Doesn’t affect setup.

  • Doesn’t affect test docstring if used with -v parameter.

To change the docstring printout based on the varibales passed to test, use the plugin nose-docstring-modifier.

Authors:

Sergey Ragatsky

Contributors:

Tal Ben Basat

Nicole Franco

Roy Klinger

Maroun Maroun

Version:

0.0.1 of 25/11/2014

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

nose_ittr-0.0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

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