Anonymous avatar Anonymous committed 7ee78e3

Added a unit test for a loader plugin function

Comments (0)

Files changed (3)

nose2/plugins/plugins.cfg

         nose2.plugins.testid
         nose2.plugins.loader
         unittest2.plugins.moduleloading
+        unittest2.plugins.testcoverage
 
 [nose-functions]
 always-on = True

nose2/tests/test_loader_plugin.py

+import unittest2
+
+from ..plugins import loader
+
+class LoaderUnitTests(unittest2.TestCase):
+    def test_unpack_handles_nose_style_generators(self):
+        def gen():
+            for i in range(0, 3):
+                yield 'call', i, i + 1
+        expect = [(0, ('call', (0, 1))),
+                  (1, ('call', (1, 2))),
+                  (2, ('call', (2, 3))),]
+        out = list(loader.Functions().unpack(gen()))
+        self.assertEqual(out, expect)
+
+    def test_unpack_handles_unittest2_style_generators(self):
+        def gen():
+            for i in range(0, 3):
+                yield 'call', (i, i + 1)
+        expect = [(0, ('call', (0, 1))),
+                  (1, ('call', (1, 2))),
+                  (2, ('call', (2, 3))),]
+        out = list(loader.Functions().unpack(gen()))
+        self.assertEqual(out, expect)

nose2/tests/test_logcapture_plugin.py

         self.plugin = LogCapture()
 
     def event(self, error=True, failed=False):
-        e = Event
+        e = Event()
         e.error = True
         e.failed = False
         e.traceback = ''
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.