Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/tutorius/tests')
-rw-r--r--src/sugar/tutorius/tests/coretests.py15
-rwxr-xr-xsrc/sugar/tutorius/tests/run-tests.py38
2 files changed, 50 insertions, 3 deletions
diff --git a/src/sugar/tutorius/tests/coretests.py b/src/sugar/tutorius/tests/coretests.py
index ed5a7c0..7792930 100644
--- a/src/sugar/tutorius/tests/coretests.py
+++ b/src/sugar/tutorius/tests/coretests.py
@@ -93,6 +93,21 @@ class TriggerEventFilter(EventFilter):
def _inner_cb(self, event_filter):
self.toggle_on_callback = not self.toggle_on_callback
+class BaseActionTests(unittest.TestCase):
+ def test_do_unimplemented(self):
+ act = Action()
+ try:
+ act.do()
+ assert False, "do() should trigger a NotImplemented"
+ except NotImplementedError:
+ assert True, "do() should trigger a NotImplemented"
+
+ def test_undo(self):
+ act = Action()
+ act.undo()
+ assert True, "undo() should never fail on the base action"
+
+
class OnceWrapperTests(unittest.TestCase):
def test_onceaction_toggle(self):
"""
diff --git a/src/sugar/tutorius/tests/run-tests.py b/src/sugar/tutorius/tests/run-tests.py
index 74efd64..db10c54 100755
--- a/src/sugar/tutorius/tests/run-tests.py
+++ b/src/sugar/tutorius/tests/run-tests.py
@@ -2,11 +2,43 @@
# This is a dumb script to run tests on the sugar-jhbuild installed files
# The path added is the default path for the jhbuild build
+INSTALL_PATH="../../../../../../install/lib/python2.5/site-packages/"
+
import os, sys
sys.path.insert(0,
- os.path.abspath("../../../../../../install/lib/python2.5/site-packages/")
+ os.path.abspath(INSTALL_PATH)
)
+
+FULL_PATH = os.path.join(INSTALL_PATH,"sugar/tutorius")
+GLOB_PATH = os.path.join(FULL_PATH,"*.py")
import unittest
-from coretests import *
+from glob import glob
+
+import sys
+if __name__=='__main__':
+ if "--coverage" in sys.argv:
+ sys.argv=[arg for arg in sys.argv if arg != "--coverage"]
+ import coverage
+ coverage.erase()
+ #coverage.exclude('raise NotImplementedError')
+ coverage.start()
+
+ import coretests
+ import servicestests
+
+
+ suite = unittest.TestSuite()
+ suite.addTests(unittest.findTestCases(coretests))
+ suite.addTests(unittest.findTestCases(servicestests))
+
+ runner = unittest.TextTestRunner()
+ runner.run(suite)
+
+ coverage.stop()
+ coverage.report(glob(GLOB_PATH))
+ coverage.erase()
+ else:
+ from coretests import *
+ from servicestests import *
-unittest.main()
+ unittest.main()