summaryrefslogtreecommitdiff
path: root/functional_tests/test_suite.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2007-04-16 17:25:11 +0000
committerJason Pellerin <jpellerin@gmail.com>2007-04-16 17:25:11 +0000
commit2051b288558683c416924972bd4c53ab6bb6535d (patch)
treeffbdd5db352d9d0dacf66e78e9fa785c7ef6cb9d /functional_tests/test_suite.py
parent8c9da94bf72df9aa834a8b7ed310cc46303de81d (diff)
downloadnose-2051b288558683c416924972bd4c53ab6bb6535d.tar.gz
Work in progress on loadTestsFromNames/context suite interaction
Diffstat (limited to 'functional_tests/test_suite.py')
-rw-r--r--functional_tests/test_suite.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/functional_tests/test_suite.py b/functional_tests/test_suite.py
new file mode 100644
index 0000000..a411469
--- /dev/null
+++ b/functional_tests/test_suite.py
@@ -0,0 +1,47 @@
+import os
+import sys
+import unittest
+from nose import case
+from nose.suite import ContextSuiteFactory
+
+support = os.path.abspath(os.path.join(os.path.dirname(__file__), 'support'))
+
+class TestContextSuiteFactory(unittest.TestCase):
+
+ def setUp(self):
+ self._mods = sys.modules.copy()
+ self._path = sys.path[:]
+ sys.path.insert(0, os.path.join(support, 'package2'))
+
+ def tearDown(self):
+ to_del = [ m for m in sys.modules.keys() if
+ m not in self._mods ]
+ if to_del:
+ for mod in to_del:
+ del sys.modules[mod]
+ sys.modules.update(self._mods)
+ sys.path = self._path
+
+ def test_find_context(self):
+ from test_pak import test_mod
+
+ factory = ContextSuiteFactory()
+ tests = [case.FunctionTestCase(test_mod.test_add),
+ case.FunctionTestCase(test_mod.test_minus)]
+ suite = factory(tests)
+ self.assertEqual(suite.context, test_mod)
+
+ def test_ancestry(self):
+ from test_pak.test_sub.test_mod import TestMaths
+ from test_pak.test_sub import test_mod
+ from test_pak import test_sub
+ import test_pak
+
+ factory = ContextSuiteFactory()
+ ancestry = [l for l in factory.ancestry(TestMaths)]
+ self.assertEqual(ancestry,
+ [test_mod, test_sub, test_pak])
+
+
+if __name__ == '__main__':
+ unittest.main()