summaryrefslogtreecommitdiff
path: root/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-03-24 14:31:33 -0500
committerBryan Bishop <kanzure@gmail.com>2012-03-24 14:31:33 -0500
commit4a4cbea33d091518bac4e246b064cc3353e8161f (patch)
treec5276fa721ef1c792d9b84dc0efdd53b8c504c97 /crystal.py
parent01dcbb2019ef4c48bedccdf8381171b3bb9bd267 (diff)
new test: test_report_untested
original-commit-id: c11794250f3611232a8c0daf4401d1657e323f70
Diffstat (limited to 'crystal.py')
-rw-r--r--crystal.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/crystal.py b/crystal.py
index da30c14..71a30dd 100644
--- a/crystal.py
+++ b/crystal.py
@@ -4710,6 +4710,15 @@ class TestMetaTesting(unittest.TestCase):
classes = [x[1] for x in tests]
for test in suite._tests:
self.assertIn(test.__class__, classes)
+ def test_report_untested(self):
+ untested = find_untested_methods()
+ output = report_untested()
+ if len(untested) > 0:
+ self.assertIn("NOT TESTED", output)
+ for name in untested:
+ self.assertIn(name, output)
+ elif len(untested) == 0:
+ self.assertNotIn("NOT TESTED", output)
def assemble_test_cases():
"""finds classes that inherit from unittest.TestCase
because i am too lazy to remember to add them to a
@@ -4739,7 +4748,7 @@ def find_untested_methods():
by searching for method names in test case
method names."""
untested = []
- avoid_funcs = ["main", "run_main", "run_tests", "copy", "deepcopy"]
+ avoid_funcs = ["main", "run_tests", "copy", "deepcopy"]
test_funcs = []
#get a list of all classes in this module
classes = inspect.getmembers(sys.modules[__name__], inspect.isclass)
@@ -4769,7 +4778,8 @@ def find_untested_methods():
return untested
def report_untested():
untested = find_untested_methods()
- print "NOT TESTED: " + str(untested)
+ output = "NOT TESTED: " + str(untested)
+ return output
#### ways to run this file ####
@@ -4777,7 +4787,7 @@ def run_tests(): #rather than unittest.main()
loader = unittest.TestLoader()
suite = load_tests(loader, None, None)
unittest.TextTestRunner(verbosity=2).run(suite)
- report_untested()
+ print report_untested()
def run_main():
#read the rom and figure out the offsets for maps
load_rom()