Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 86 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typing-extensions = [
optional = true

[tool.poetry.group.test.dependencies]
anyio = { version = ">= 3.7.1" }
pytest = [
{ version = "^8.3", python = ">=3.8" },
{ version = "^7.4", python = "<3.8" }
Expand Down Expand Up @@ -321,7 +322,7 @@ addopts = "--benchmark-disable"
# Deactivate default name pattern for test classes (we use pytest_describe).
python_classes = "PyTest*"
# Handle all async fixtures and tests automatically by asyncio,
asyncio_mode = "auto"
asyncio_mode = "strict"
# Set a timeout in seconds for aborting tests that run too long.
timeout = "100"
# Ignore config options not (yet) available in older Python versions.
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ def pytest_collection_modifyitems(config, items):
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)


@pytest.fixture
def anyio_backend():
return "asyncio"
4 changes: 2 additions & 2 deletions tests/execution/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

def sync_and_async(spec):
"""Decorator for running a test synchronously and asynchronously."""
return pytest.mark.asyncio(
return pytest.mark.anyio(
pytest.mark.parametrize("sync", [True, False], ids=("sync", "async"))(spec)
)


def access_variants(spec):
"""Decorator for tests with dict and object access, including inheritance."""
return pytest.mark.asyncio(
return pytest.mark.anyio(
pytest.mark.parametrize("access", ["dict", "object", "inheritance"])(spec)
)

Expand Down
4 changes: 2 additions & 2 deletions tests/execution/test_customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from graphql.language import parse
from graphql.type import GraphQLField, GraphQLObjectType, GraphQLSchema, GraphQLString

pytestmark = pytest.mark.anyio

try:
anext # noqa: B018
except NameError: # pragma: no cover (Python < 3.10)
Expand Down Expand Up @@ -78,7 +80,6 @@ def execute_field(


def describe_customize_subscription():
@pytest.mark.asyncio
async def uses_a_custom_subscribe_field_resolver():
schema = GraphQLSchema(
query=GraphQLObjectType("Query", {"foo": GraphQLField(GraphQLString)}),
Expand Down Expand Up @@ -107,7 +108,6 @@ async def custom_foo():

await subscription.aclose()

@pytest.mark.asyncio
async def uses_a_custom_execution_context_class():
class TestExecutionContext(ExecutionContext):
def __init__(self, *args, **kwargs):
Expand Down
Loading
Loading