Skip to content

Commit 9614d83

Browse files
committed
skips
1 parent e5a8509 commit 9614d83

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

testing/test_basic.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ def skip_if_no_async_generators():
9393
)
9494

9595

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+
96111
@pytest.fixture
97112
def cmd_opts(request):
98113
reactor = request.config.getoption("reactor", "default")
@@ -1257,6 +1272,8 @@ def test_should_not_run():
12571272
assert re.match(pattern, rr.stdout.str()) is None
12581273

12591274

1275+
@skip_if_no_async_await()
1276+
@skip_if_hypothesis_unavailable()
12601277
def test_hypothesis_async_passes(testdir, cmd_opts):
12611278
test_file = """
12621279
import hypothesis
@@ -1274,6 +1291,7 @@ async def test_async(x):
12741291
assert_outcomes(rr, {"passed": 1})
12751292

12761293

1294+
@skip_if_hypothesis_unavailable()
12771295
def test_hypothesis_inline_callbacks_passes(testdir, cmd_opts):
12781296
test_file = """
12791297
import hypothesis
@@ -1293,7 +1311,9 @@ def test_inline_callbacks(x):
12931311
assert_outcomes(rr, {"passed": 1})
12941312

12951313

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):
12971317
test_file = """
12981318
import hypothesis
12991319
import hypothesis.strategies
@@ -1310,6 +1330,7 @@ async def test_async(x):
13101330
assert_outcomes(rr, {"failed": 1})
13111331

13121332

1333+
@skip_if_hypothesis_unavailable()
13131334
def test_hypothesis_inline_callbacks_fails(testdir, cmd_opts):
13141335
test_file = """
13151336
import hypothesis

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ deps=
1111
greenlet
1212
pytest
1313
twisted
14-
hypothesis
14+
py37,py38,py39,pypy37,pypy38: hypothesis
1515
pyqt5reactor,pyside2reactor: pytest-qt
1616
pyqt5reactor,pyside2reactor: pytest-xvfb
1717
pyqt5reactor,pyside2reactor: pywin32; sys_platform == 'win32'

0 commit comments

Comments
 (0)