Skip to content

Instantly share code, notes, and snippets.

@madsmtm
Created December 9, 2018 13:41
Show Gist options
  • Save madsmtm/32db9e6b4a466835b58696e04e3e3086 to your computer and use it in GitHub Desktop.
Save madsmtm/32db9e6b4a466835b58696e04e3e3086 to your computer and use it in GitHub Desktop.
Graphene pytest fixtures
from pytest import fixture
from graphene.test import Client
@fixture(scope="session")
def _schema():
raise NotImplementedError(
"You must implement this fixture yourself."
"It should return an instance of `graphene.Schema`"
)
@fixture
def client(_schema):
return Client(_schema)
@fixture
def execute(client):
return client.execute
@fixture
def format_result(client):
return client.format_result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment