-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pytest | ||
|
||
|
||
test_text = """ | ||
import pytest | ||
import trio | ||
from hypothesis import given, settings, strategies | ||
async def test_pass(): | ||
await trio.sleep(0) | ||
async def test_fail(): | ||
await trio.sleep(0) | ||
assert False | ||
@settings(deadline=None, max_examples=5) | ||
@given(strategies.binary()) | ||
async def test_hypothesis_pass(b): | ||
await trio.sleep(0) | ||
assert isinstance(b, bytes) | ||
@settings(deadline=None, max_examples=5) | ||
@given(strategies.binary()) | ||
async def test_hypothesis_fail(b): | ||
await trio.sleep(0) | ||
assert isinstance(b, int) | ||
""" | ||
|
||
|
||
def test_trio_mode_pytest_ini(testdir): | ||
testdir.makepyfile(test_text) | ||
|
||
testdir.makefile(".ini", pytest="[pytest]\ntrio_mode = true\n") | ||
|
||
result = testdir.runpytest() | ||
result.assert_outcomes(passed=2, failed=2) | ||
|
||
|
||
def test_trio_mode_conftest(testdir): | ||
testdir.makepyfile(test_text) | ||
|
||
testdir.makeconftest("from pytest_trio.enable_trio_mode import *") | ||
|
||
result = testdir.runpytest() | ||
result.assert_outcomes(passed=2, failed=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
__all__ = ["pytest_collection_modifyitems"] | ||
|
||
from .plugin import automark | ||
|
||
|
||
def pytest_collection_modifyitems(items): | ||
automark(items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters