Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include tests and examples in source package, but don't install them #1034

Merged
merged 1 commit into from
Oct 19, 2020
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
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
include README.md LICENSE
recursive-include graphene_django/templates *
recursive-include graphene_django/static *

include examples/cookbook/cookbook/ingredients/fixtures/ingredients.json
include examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json
35 changes: 0 additions & 35 deletions django_test_settings.py

This file was deleted.

Empty file added examples/__init__.py
Empty file.
Empty file.
Empty file added examples/cookbook/__init__.py
Empty file.
30 changes: 30 additions & 0 deletions examples/django_test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sys
import os

ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, ROOT_PATH + "/examples/")

SECRET_KEY = 1

INSTALLED_APPS = [
"graphene_django",
"graphene_django.rest_framework",
"graphene_django.tests",
"examples.starwars",
]

DATABASES = {
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "django_test.sqlite"}
}

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
}
]

GRAPHENE = {"SCHEMA": "graphene_django.tests.schema_view.schema"}

ROOT_URLCONF = "graphene_django.tests.urls"
6 changes: 3 additions & 3 deletions graphene_django/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def resolve_reporters(_, info):
result = schema.execute(query)

assert not result.errors
assert result.data == {"reporters": [{"firstName": "Tara"},]}
assert result.data == {"reporters": [{"firstName": "Tara"}]}

def test_resolve_list(self):
"""Resolving a plain list should work (and not call get_queryset)"""
Expand Down Expand Up @@ -314,7 +314,7 @@ def resolve_reporters(_, info):
result = schema.execute(query)

assert not result.errors
assert result.data == {"reporters": [{"firstName": "Debra"},]}
assert result.data == {"reporters": [{"firstName": "Debra"}]}

def test_get_queryset_foreign_key(self):
class Article(DjangoObjectType):
Expand Down Expand Up @@ -371,7 +371,7 @@ class Query(ObjectType):
assert not result.errors
assert result.data == {
"reporters": [
{"firstName": "Tara", "articles": [{"headline": "Amazing news"},],},
{"firstName": "Tara", "articles": [{"headline": "Amazing news"}]},
{"firstName": "Debra", "articles": []},
]
}
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = django_test_settings
DJANGO_SETTINGS_MODULE = examples.django_test_settings
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"Framework :: Django :: 3.0",
],
keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["tests"]),
packages=find_packages(exclude=["tests", "examples", "examples.*"]),
install_requires=[
"six>=1.10.0",
"graphene>=2.1.7,<3",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DJANGO =
passenv = *
usedevelop = True
setenv =
DJANGO_SETTINGS_MODULE=django_test_settings
DJANGO_SETTINGS_MODULE=examples.django_test_settings
deps =
-e.[test]
psycopg2-binary
Expand Down