summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-05-25 17:12:39 +0100
committerLars Wirzenius <liw@liw.fi>2011-05-25 17:12:39 +0100
commit927369b6d45b1e03cbc3a29610a2e035c7b77bd2 (patch)
tree5d5c7d7133c361d2cefe91beec71931cde6e7fb6
parent41a137be9ce99cc5d955711df94ce130d15da92c (diff)
downloadbgproc-927369b6d45b1e03cbc3a29610a2e035c7b77bd2.tar.gz
Iterating over results results in nothing.
Had to add a dummy yield to make __iter__ be a generator.
-rw-r--r--bgproc.py2
-rw-r--r--bgproc_tests.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/bgproc.py b/bgproc.py
index 73aa052..10dd2f4 100644
--- a/bgproc.py
+++ b/bgproc.py
@@ -46,3 +46,5 @@ class BackgroundProcessing(object):
def __iter__(self):
'''Iterate over immediately available results.'''
+ if False:
+ yield
diff --git a/bgproc_tests.py b/bgproc_tests.py
index 5dbe53c..17bc4fc 100644
--- a/bgproc_tests.py
+++ b/bgproc_tests.py
@@ -38,3 +38,6 @@ class BackgroundProcessingTests(unittest.TestCase):
def test_wait_for_results_returns_false_initially(self):
self.assertEqual(self.bg.wait_for_results(), False)
+ def test_iterates_to_empty_list_initially(self):
+ self.assertEqual(list(self.bg), [])
+