Skip to main content

Run a test case multiple times with different data

Project description

datadriven

datadriven allows you to run a test case multiple times with different data. It was designed to work with unittest.TestCase test methods, any test runner (nose, nose2, unittest, unittest2 and pytest), in Python 2.7 or 3.7+.

Usage

import datadriven

class SomeTestCase(unittest.TestCase):

    @datadriven.datadriven(
        caseA=datadriven.Args(first="foo"),
        caseB=datadriven.Args("hello", second="world"),
    )
    def test_method(self, first, second=None):
        ...

This is the equivalent of writing:

import datadriven

class SomeTestCase(unittest.TestCase):

    def test_method(self, first, second=None):
        ...

    def test_method_caseA(self):
        self.test_method("foo")

    def test_method_caseB(self):
        self.test_method("hello", "world")

The only difference is that when wrapped with @datadriven, the test test_method won't be really executed.

License

Apache-2.0 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

datadriven-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distributions

datadriven-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

datadriven-1.0.0-py2-none-any.whl (7.0 kB view details)

Uploaded Python 2

File details

Details for the file datadriven-1.0.0.tar.gz.

File metadata

  • Download URL: datadriven-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for datadriven-1.0.0.tar.gz
Algorithm Hash digest
SHA256 df6d69c122e0e94dafe0544b1368c7396ccd1417fa96973b622c7e4f0fd77236
MD5 b994a8fa6a23a71471ce339cb6911cfe
BLAKE2b-256 6314f92ea21fc7af616a09e1b1f783ddf9b5fa1a7749ae5819cc822ef650977f

See more details on using hashes here.

File details

Details for the file datadriven-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: datadriven-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for datadriven-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 796abff2973dc4692ee8736f6e619829b172078d188d74e0eea13a0978e8e596
MD5 910b83ada951a5208c1dfeb5364bd378
BLAKE2b-256 da4f61cc2287cc6aa3444e05a0b10bc5533ea9921c07665df32691053902e631

See more details on using hashes here.

File details

Details for the file datadriven-1.0.0-py2-none-any.whl.

File metadata

  • Download URL: datadriven-1.0.0-py2-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for datadriven-1.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 a63c3c5a43b66f444bf408cfb99f9a38339bbb1625efe39233db258ac46ce3c9
MD5 12d5a39848da62f4ecef4d670db31895
BLAKE2b-256 41d50750f8f3d9fd30cecfa72bd5eaaa47e6d876d5972c91dfbb869c223e967e

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