aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2014-08-23 20:58:55 +0200
committerAndré Erdmann <dywi@mailerd.de>2014-08-23 20:58:55 +0200
commit14ce917c1ff12f93894adcd6712a00ca5331e12a (patch)
tree9e566d9677962ce2a48501c16ae3894c2548333b
parentroverlay/depres/depenv: skip vmod dict lookup (diff)
downloadR_overlay-14ce917c1ff12f93894adcd6712a00ca5331e12a.tar.gz
R_overlay-14ce917c1ff12f93894adcd6712a00ca5331e12a.tar.bz2
R_overlay-14ce917c1ff12f93894adcd6712a00ca5331e12a.zip
tests/depres.py: print test data identifier
Helps when tests fail.
-rw-r--r--tests/depres.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/depres.py b/tests/depres.py
index 77a6857..238731c 100644
--- a/tests/depres.py
+++ b/tests/depres.py
@@ -61,7 +61,7 @@ class DepresTestCase ( tests.interface.RoverlayInterfaceTestCase ):
self.depres.update()
# --- end of tearDown (...) ---
- def do_depres_test ( self, rule_names, test_data ):
+ def do_depres_test ( self, test_identifier, rule_names, test_data ):
unpacked = lambda T: \
( "" if T[0] is None else T[0] ) if T and len ( T ) == 1 else T
@@ -81,21 +81,21 @@ class DepresTestCase ( tests.interface.RoverlayInterfaceTestCase ):
self.assertEquals (
result, expected_result,
- "{!r} should be resolved as {!r} and not {!r}".format (
- depstr, expected_result, result
+ "{!s}: {!r} should be resolved as {!r} and not {!r}".format (
+ test_identifier, depstr, expected_result, result
)
)
# --- end of do_depres_test (...) ---
def do_randomized_depres_test (
- self, rule_names, test_data, allow_modify=False
+ self, test_identifier, rule_names, test_data, allow_modify=False
):
if allow_modify and isinstance ( test_data, list ):
rand_list = test_data
else:
rand_list = list ( test_data )
random.shuffle ( rand_list )
- return self.do_depres_test ( rule_names, rand_list )
+ return self.do_depres_test ( test_identifier, rule_names, rand_list )
# --- end of do_randomized_depres_test (...) ---
def get_depres_include ( self, dataset_name ):
@@ -140,6 +140,7 @@ class DepresTestCase ( tests.interface.RoverlayInterfaceTestCase ):
def test_depres_static ( self ):
for name, test_data in DEPRES_DATA.items():
self.do_depres_test (
+ name,
self.get_depres_include ( name ),
DEPRES_DATA [test_data] if isinstance ( test_data, str )
else test_data
@@ -153,6 +154,7 @@ class DepresTestCase ( tests.interface.RoverlayInterfaceTestCase ):
for name in data_keys:
test_data = DEPRES_DATA [name]
self.do_randomized_depres_test (
+ name,
self.get_depres_include ( name ),
DEPRES_DATA [test_data] if isinstance ( test_data, str )
else test_data