diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-06 23:41:20 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-07 00:05:09 +0200 |
commit | 6a252661c3bf4202a4d571f9c41d2afa48d9d75f (patch) | |
tree | 6c46c78078d91aa90b93f18b9c32215b4be57ee0 /test/git/async/test_thread.py | |
parent | 867129e2950458ab75523b920a5e227e3efa8bbc (diff) | |
download | gitpython-6a252661c3bf4202a4d571f9c41d2afa48d9d75f.tar.gz |
pool: First version which works as expected in async mode. Its just using a single task for now, but next up are dependent tasks
Diffstat (limited to 'test/git/async/test_thread.py')
-rw-r--r-- | test/git/async/test_thread.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/test/git/async/test_thread.py b/test/git/async/test_thread.py index 2ea8d1ff..a08c1dc7 100644 --- a/test/git/async/test_thread.py +++ b/test/git/async/test_thread.py @@ -3,28 +3,26 @@ from test.testlib import * from git.async.thread import * from Queue import Queue +import time class TestWorker(WorkerThread): def __init__(self, *args, **kwargs): super(TestWorker, self).__init__(*args, **kwargs) self.reset() - def fun(self, *args, **kwargs): + def fun(self, arg): self.called = True - self.args = args - self.kwargs = kwargs + self.arg = arg return True def make_assertion(self): assert self.called - assert self.args - assert self.kwargs + assert self.arg self.reset() def reset(self): self.called = False - self.args = None - self.kwargs = None + self.arg = None class TestThreads( TestCase ): @@ -36,10 +34,11 @@ class TestThreads( TestCase ): # test different method types standalone_func = lambda *args, **kwargs: worker.fun(*args, **kwargs) - for function in ("fun", TestWorker.fun, worker.fun, standalone_func): - worker.call(function, 1, this='that') + for function in (TestWorker.fun, worker.fun, standalone_func): + worker.inq.put((function, 1)) + time.sleep(0.01) worker.make_assertion() # END for each function type - worker.call('quit') + worker.stop_and_join() |