@@ -93,6 +93,21 @@ def skip_if_no_async_generators():
93
93
)
94
94
95
95
96
+ def skip_if_hypothesis_unavailable ():
97
+ def hypothesis_unavailable ():
98
+ try :
99
+ import hypothesis
100
+ except ImportError :
101
+ return True
102
+
103
+ return False
104
+
105
+ return pytest .mark .skipif (
106
+ hypothesis_unavailable (),
107
+ reason = "hypothesis not installed" ,
108
+ )
109
+
110
+
96
111
@pytest .fixture
97
112
def cmd_opts (request ):
98
113
reactor = request .config .getoption ("reactor" , "default" )
@@ -1257,6 +1272,8 @@ def test_should_not_run():
1257
1272
assert re .match (pattern , rr .stdout .str ()) is None
1258
1273
1259
1274
1275
+ @skip_if_no_async_await ()
1276
+ @skip_if_hypothesis_unavailable ()
1260
1277
def test_hypothesis_async_passes (testdir , cmd_opts ):
1261
1278
test_file = """
1262
1279
import hypothesis
@@ -1274,6 +1291,7 @@ async def test_async(x):
1274
1291
assert_outcomes (rr , {"passed" : 1 })
1275
1292
1276
1293
1294
+ @skip_if_hypothesis_unavailable ()
1277
1295
def test_hypothesis_inline_callbacks_passes (testdir , cmd_opts ):
1278
1296
test_file = """
1279
1297
import hypothesis
@@ -1293,7 +1311,9 @@ def test_inline_callbacks(x):
1293
1311
assert_outcomes (rr , {"passed" : 1 })
1294
1312
1295
1313
1296
- def test_hypothesis_async_ils (testdir , cmd_opts ):
1314
+ @skip_if_no_async_await ()
1315
+ @skip_if_hypothesis_unavailable ()
1316
+ def test_hypothesis_async_fails (testdir , cmd_opts ):
1297
1317
test_file = """
1298
1318
import hypothesis
1299
1319
import hypothesis.strategies
@@ -1310,6 +1330,7 @@ async def test_async(x):
1310
1330
assert_outcomes (rr , {"failed" : 1 })
1311
1331
1312
1332
1333
+ @skip_if_hypothesis_unavailable ()
1313
1334
def test_hypothesis_inline_callbacks_fails (testdir , cmd_opts ):
1314
1335
test_file = """
1315
1336
import hypothesis
0 commit comments