Tools for unit testing: data_provider and FixtureManager
Project description
Test files in project
/tests __init__.py /pkg1 /fixtures foo1.json foo2.json __init__.py test1.py /pkg2 /fixtures bar1.json bar2.json __init__.py test2.py
Content of “tests/pkg1/fixtures/foo1.json”:
{ "blah1": [ ["foo"], ["bar"], [1], [2], [true], [null] ], "blah2": [ [-1234, 0], [3456, -2.345], [1, 1], [99999, false], [11, 789], [null, null] ] }
Content of “tests/pkg1/test1”:
from unittest import TestCase from test_tools import data_provider, FixtureManager fx_man1 = FixtureManager() fx_man1.load(fixture_file='foo1') fx_man2 = FixtureManager() fx_man2.load(fixture_file='foo2') class MyTestCase(TestCase): @data_provider(fx_man1['blah1']) def test_my_cool_feature(self, param1): # some code pass @data_provider(fx_man1['blah2']) def test_my_cool_feature(self, param1, param2): # some code pass @data_provider(fx_man2['blah3']) def test_my_cool_feature(self, param): # some code pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
test-tools-0.0.3.tar.gz
(4.4 kB
view details)
File details
Details for the file test-tools-0.0.3.tar.gz
.
File metadata
- Download URL: test-tools-0.0.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 946271aad70a05b4e2e49b312de6c7cd64264d2b7c85ade1b9bcbb8f0d243f7a |
|
MD5 | a9d948b0c7402a58a66b2c410166df01 |
|
BLAKE2b-256 | 40b97c5742f8c12ee7b182b77ccdcd47da9756557b11175433be4b02c49d9a15 |