diff options
| author | Michele Simionato <michele.simionato@gmail.com> | 2015-07-19 19:13:36 +0200 |
|---|---|---|
| committer | Michele Simionato <michele.simionato@gmail.com> | 2015-07-19 19:13:36 +0200 |
| commit | a4e7a82790a134ca44746de88bdc0354e90c442c (patch) | |
| tree | 471fc9c4775b2a3660148e4a0c77acb58bbee788 /test.py | |
| parent | cf20ab367249c9eca473d6f9989f0721e451b033 (diff) | |
| download | python-decorator-git-a4e7a82790a134ca44746de88bdc0354e90c442c.tar.gz | |
Simplified the concurrency example by using a Future class
Diffstat (limited to 'test.py')
| -rw-r--r-- | test.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -4,6 +4,7 @@ Some simple tests import os import sys +import time import doctest from decorator import decorator import documentation @@ -34,9 +35,18 @@ def test1(): this = getfname(f1) assert this == 'test.py', this + +def test_long_running(): + f1 = documentation.long_running(1) + f2 = documentation.long_running(2) + assert f1.result() + f2.result() == 3 + if __name__ == '__main__': + t0 = time.time() for name, test in list(globals().items()): if name.startswith('test'): test() err = doctest.testmod(documentation)[0] + t1 = time.time() + print('Tests run in %s seconds' % (t1 - t0)) sys.exit(err) |
