summaryrefslogtreecommitdiff
path: root/test/git/async
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-06 01:00:12 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-06 01:00:12 +0200
commitb72e2704022d889f116e49abf3e1e5d3e3192d3b (patch)
tree65d2f5835a4853e72eb4b3cb5beb1b26aabcba36 /test/git/async
parentab59f78341f1dd188aaf4c30526f6295c63438b1 (diff)
downloadgitpython-b72e2704022d889f116e49abf3e1e5d3e3192d3b.tar.gz
Improved pool design and started rough implementation, top down to learn while going. Tests will be written soon for verification, its still quite theoretical
Diffstat (limited to 'test/git/async')
-rw-r--r--test/git/async/test_channel.py22
-rw-r--r--test/git/async/test_graph.py10
2 files changed, 24 insertions, 8 deletions
diff --git a/test/git/async/test_channel.py b/test/git/async/test_channel.py
index ad68a8d5..2a3c1585 100644
--- a/test/git/async/test_channel.py
+++ b/test/git/async/test_channel.py
@@ -20,12 +20,15 @@ class TestChannels(TestBase):
item2 = 2
wc.write(item)
wc.write(item2)
- assert rc.read() == item
- assert rc.read() == item2
+
+ # read all - it blocks as its still open for writing
+ st = time.time()
+ assert rc.read(timeout=1) == [item, item2]
+ assert time.time() - st >= 1.0
# next read blocks, then raises - it waits a second
st = time.time()
- self.failUnlessRaises(IOError, rc.read, True, 1)
+ assert len(rc.read(1, True, 1)) == 0
assert time.time() - st >= 1.0
# writing to a closed channel raises
@@ -38,7 +41,7 @@ class TestChannels(TestBase):
self.failUnlessRaises(IOError, wc.write, 1)
# reading from a closed channel never blocks
- self.failUnlessRaises(IOError, rc.read)
+ assert len(rc.read()) == 0
@@ -49,13 +52,16 @@ class TestChannels(TestBase):
# blocks for a second, its full
st = time.time()
- self.failUnlessRaises(IOError, wc.write, item, True, 1)
+ self.failUnlessRaises(EOFError, wc.write, item, True, 1)
assert time.time() - st >= 1.0
- # get one
- assert rc.read() == item
+ # get our only one
+ assert rc.read(1)[0] == item
# its empty,can put one again
wc.write(item2)
- assert rc.read() == item2
wc.close()
+
+ # reading 10 will only yield one, it will not block as its closed
+ assert rc.read(10, timeout=1)[0] == item2
+
diff --git a/test/git/async/test_graph.py b/test/git/async/test_graph.py
new file mode 100644
index 00000000..18d6997c
--- /dev/null
+++ b/test/git/async/test_graph.py
@@ -0,0 +1,10 @@
+"""Channel testing"""
+from test.testlib import *
+from git.async.graph import *
+
+import time
+
+class TestGraph(TestBase):
+
+ def test_base(self):
+ pass