Mercurial > hg
comparison tests/hypothesishelpers.py @ 27999:b30b40804a3f
tests: pass settings of hypothesis by with statement
given(..., settings=) is no longer available in Hypothesis 2.0.0.
https://github.com/DRMacIver/hypothesis/commit/7712c01
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 26 Jan 2016 23:05:19 +0900 |
parents | 84513a4fcc3a |
children | f33280667aa5 |
comparison
equal
deleted
inserted
replaced
27998:84513a4fcc3a | 27999:b30b40804a3f |
---|---|
31 def accept(f): | 31 def accept(f): |
32 # Workaround for https://github.com/DRMacIver/hypothesis/issues/206 | 32 # Workaround for https://github.com/DRMacIver/hypothesis/issues/206 |
33 # Fixed in version 1.13 (released 2015 october 29th) | 33 # Fixed in version 1.13 (released 2015 october 29th) |
34 f.__module__ = '__anon__' | 34 f.__module__ = '__anon__' |
35 try: | 35 try: |
36 given(*args, settings=settings(max_examples=2000), **kwargs)(f)() | 36 with settings(max_examples=2000): |
37 given(*args, **kwargs)(f)() | |
37 except Exception: | 38 except Exception: |
38 traceback.print_exc(file=sys.stdout) | 39 traceback.print_exc(file=sys.stdout) |
39 sys.exit(1) | 40 sys.exit(1) |
40 return accept | 41 return accept |
41 | 42 |