|
14 | 14 | from jmespath import exceptions
|
15 | 15 |
|
16 | 16 |
|
17 |
| -MAX_EXAMPLES = int(os.environ.get('JP_MAX_EXAMPLES', 100)) |
18 |
| -if sys.version_info[:2] != (2, 6): |
19 |
| - RANDOM_JSON = st.recursive( |
20 |
| - st.floats() | st.booleans() | st.text() | st.none(), |
21 |
| - lambda children: st.lists(children) | st.dictionaries(st.text(), children) |
22 |
| - ) |
23 |
| -else: |
24 |
| - # hypothesis doesn't work on py26 and the prevous definition of |
25 |
| - # RANDOM_JSON would throw an error. We set RANDOM_JSON to some |
26 |
| - # arbitrary value that we know will work. This isn't going to get |
27 |
| - # called anyways. |
28 |
| - # XXX: Is there a better way to do this? |
29 |
| - RANDOM_JSON = st.none() |
| 17 | +if sys.version_info[:2] == (2, 6): |
| 18 | + raise RuntimeError("Hypothesis tests are not supported on python2.6. " |
| 19 | + "Use python2.7, or python3.3 and greater.") |
30 | 20 |
|
31 | 21 |
|
| 22 | +RANDOM_JSON = st.recursive( |
| 23 | + st.floats() | st.booleans() | st.text() | st.none(), |
| 24 | + lambda children: st.lists(children) | st.dictionaries(st.text(), children) |
| 25 | +) |
| 26 | + |
| 27 | + |
| 28 | +MAX_EXAMPLES = int(os.environ.get('JP_MAX_EXAMPLES', 1000)) |
32 | 29 | BASE_SETTINGS = {
|
33 | 30 | 'max_examples': MAX_EXAMPLES,
|
34 | 31 | 'suppress_health_check': [HealthCheck.too_slow],
|
35 | 32 | }
|
36 | 33 |
|
37 | 34 |
|
38 |
| -def setup_module(): |
39 |
| - if sys.version_info[:2] == (2, 6): |
40 |
| - raise SkipTest("Hypothesis test not supported on py26") |
41 |
| - |
42 |
| - |
43 | 35 | # For all of these tests they verify these proprties:
|
44 | 36 | # either the operation succeeds or it raises a JMESPathError.
|
45 | 37 | # If any other exception is raised then we error out.
|
|
0 commit comments