garybernhardt / dingus
A record-then-assert mocking library.
Clone this repository (size: 73.7 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/garybernhardt/dingus/
| commit 50: | a4410d79c850 |
| parent 49: | ad915bdb1d8f |
| branch: | default |
Put the DingusTestCase exclusions into an argument named "exclude"
5 months ago
Changed (Δ96 bytes):
raw changeset »
dingus.py (4 lines added, 2 lines removed)
tests/test_dingus_test_case.py (2 lines added, 1 lines removed)
| … | … | @@ -7,11 +7,13 @@ import sys |
7 |
7 |
import new |
8 |
8 |
|
9 |
9 |
|
10 |
def DingusTestCase(object_under_test, |
|
10 |
def DingusTestCase(object_under_test, exclude=None): |
|
11 |
exclude = [] if exclude is None else exclude |
|
12 |
||
11 |
13 |
def get_names_under_test(): |
12 |
14 |
module = sys.modules[object_under_test.__module__] |
13 |
15 |
for name, value in module.__dict__.iteritems(): |
14 |
if value is object_under_test or name in exclu |
|
16 |
if value is object_under_test or name in exclude: |
|
15 |
17 |
yield name |
16 |
18 |
|
17 |
19 |
class TestCase(object): |
Up to file-list tests/test_dingus_test_case.py:
| … | … | @@ -8,7 +8,8 @@ from dingus import DingusTestCase, Dingu |
8 |
8 |
|
9 |
9 |
class WhenObjectIsExcludedFromTest: |
10 |
10 |
def setup(self): |
11 |
class TestCase(DingusTestCase(module.ClassUnderTest, |
|
11 |
class TestCase(DingusTestCase(module.ClassUnderTest, |
|
12 |
exclude=['Collaborator'])): |
|
12 |
13 |
pass |
13 |
14 |
self.test_case_instance = TestCase() |
14 |
15 |
self.test_case_instance.setup() |
