Skip to content

Commit ee3d4f5

Browse files
Include tests and examples in source package, but don't install them (#1034)
..., but don't install them. Also applied changes as suggested by `black`.
1 parent 2e80638 commit ee3d4f5

File tree

10 files changed

+39
-41
lines changed

10 files changed

+39
-41
lines changed

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
include README.md LICENSE
22
recursive-include graphene_django/templates *
33
recursive-include graphene_django/static *
4+
5+
include examples/cookbook/cookbook/ingredients/fixtures/ingredients.json
6+
include examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json

django_test_settings.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

examples/__init__.py

Whitespace-only changes.

examples/cookbook-plain/__init__.py

Whitespace-only changes.

examples/cookbook/__init__.py

Whitespace-only changes.

examples/django_test_settings.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
import os
3+
4+
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
5+
sys.path.insert(0, ROOT_PATH + "/examples/")
6+
7+
SECRET_KEY = 1
8+
9+
INSTALLED_APPS = [
10+
"graphene_django",
11+
"graphene_django.rest_framework",
12+
"graphene_django.tests",
13+
"examples.starwars",
14+
]
15+
16+
DATABASES = {
17+
"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "django_test.sqlite"}
18+
}
19+
20+
TEMPLATES = [
21+
{
22+
"BACKEND": "django.template.backends.django.DjangoTemplates",
23+
"DIRS": [],
24+
"APP_DIRS": True,
25+
}
26+
]
27+
28+
GRAPHENE = {"SCHEMA": "graphene_django.tests.schema_view.schema"}
29+
30+
ROOT_URLCONF = "graphene_django.tests.urls"

graphene_django/tests/test_fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def resolve_reporters(_, info):
267267
result = schema.execute(query)
268268

269269
assert not result.errors
270-
assert result.data == {"reporters": [{"firstName": "Tara"},]}
270+
assert result.data == {"reporters": [{"firstName": "Tara"}]}
271271

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

316316
assert not result.errors
317-
assert result.data == {"reporters": [{"firstName": "Debra"},]}
317+
assert result.data == {"reporters": [{"firstName": "Debra"}]}
318318

319319
def test_get_queryset_foreign_key(self):
320320
class Article(DjangoObjectType):
@@ -371,7 +371,7 @@ class Query(ObjectType):
371371
assert not result.errors
372372
assert result.data == {
373373
"reporters": [
374-
{"firstName": "Tara", "articles": [{"headline": "Amazing news"},],},
374+
{"firstName": "Tara", "articles": [{"headline": "Amazing news"}]},
375375
{"firstName": "Debra", "articles": []},
376376
]
377377
}

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
DJANGO_SETTINGS_MODULE = django_test_settings
2+
DJANGO_SETTINGS_MODULE = examples.django_test_settings

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"Framework :: Django :: 3.0",
5959
],
6060
keywords="api graphql protocol rest relay graphene",
61-
packages=find_packages(exclude=["tests"]),
61+
packages=find_packages(exclude=["tests", "examples", "examples.*"]),
6262
install_requires=[
6363
"six>=1.10.0",
6464
"graphene>=2.1.7,<3",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DJANGO =
2525
passenv = *
2626
usedevelop = True
2727
setenv =
28-
DJANGO_SETTINGS_MODULE=django_test_settings
28+
DJANGO_SETTINGS_MODULE=examples.django_test_settings
2929
deps =
3030
-e.[test]
3131
psycopg2-binary

0 commit comments

Comments
 (0)