/tests/core/test_pools.py
https://bitbucket.org/prologic/circuits/ · Python · 35 lines · 19 code · 12 blank · 4 comment · 1 complexity · 5bf01046205ebfabb543c9d7ef200fe0 MD5 · raw file
- # Module: test_pools
- # Date: 22nd February 2011
- # Author: James Mills, prologic at shortcircuit dot net dot au
- """Pools Tests"""
- import pytest
- from circuits import Task, Pool
- def f():
- x = 0
- i = 0
- while i < 1000000:
- x += 1
- i += 1
- return x
- def test():
- p = Pool()
- p.start()
- x = p.fire(Task(f))
- assert pytest.wait_for(x, "result")
- result = x.result
- assert result
- value = x.value
- assert value == 1000000
- p.stop()