Skip to content

Commit

Permalink
chore: update dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Leonard committed Sep 19, 2022
1 parent 2aeb86b commit 7b92bbb
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 52 deletions.
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@grep -E '^\.PHONY: [a-zA-Z_-]+ .*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = "(: |##)"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'

.PHONY: dev-setup ## Install development dependencies
dev-setup:
pip install -e ".[dev]"

.PHONY: install-dev
install-dev: dev-setup # Alias install-dev -> dev-setup

.PHONY: tests
.PHONY: tests ## Run unit tests
tests:
py.test graphene_django --cov=graphene_django -vv

.PHONY: test
test: tests # Alias test -> tests

.PHONY: format
.PHONY: format ## Format code
format:
black --exclude "/migrations/" graphene_django examples setup.py

.PHONY: lint
.PHONY: lint ## Lint code
lint:
flake8 graphene_django examples

Expand Down
5 changes: 4 additions & 1 deletion graphene_django/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def wrap_resolve(self, parent_resolver):
_type = _type.of_type
django_object_type = _type.of_type.of_type
return partial(
self.list_resolver, django_object_type, resolver, self.get_manager(),
self.list_resolver,
django_object_type,
resolver,
self.get_manager(),
)


Expand Down
2 changes: 1 addition & 1 deletion graphene_django/filter/filters/global_id_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GlobalIDFilter(Filter):
field_class = GlobalIDFormField

def filter(self, qs, value):
""" Convert the filter value to a primary key before filtering """
"""Convert the filter value to a primary key before filtering"""
_id = None
if value is not None:
_, _id = from_global_id(value)
Expand Down
10 changes: 4 additions & 6 deletions graphene_django/filter/filterset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@


class GrapheneFilterSetMixin(BaseFilterSet):
""" A django_filters.filterset.BaseFilterSet with default filter overrides
to handle global IDs """
"""A django_filters.filterset.BaseFilterSet with default filter overrides
to handle global IDs"""

FILTER_DEFAULTS = dict(
itertools.chain(
Expand All @@ -29,8 +29,7 @@ class GrapheneFilterSetMixin(BaseFilterSet):


def setup_filterset(filterset_class):
""" Wrap a provided filterset in Graphene-specific functionality
"""
"""Wrap a provided filterset in Graphene-specific functionality"""
return type(
"Graphene{}".format(filterset_class.__name__),
(filterset_class, GrapheneFilterSetMixin),
Expand All @@ -39,8 +38,7 @@ def setup_filterset(filterset_class):


def custom_filterset_factory(model, filterset_base_class=FilterSet, **meta):
""" Create a filterset for the given model using the provided meta data
"""
"""Create a filterset for the given model using the provided meta data"""
meta.update({"model": model})
meta_class = type(str("Meta"), (object,), meta)
filterset = type(
Expand Down
8 changes: 4 additions & 4 deletions graphene_django/filter/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class Query(graphene.ObjectType):
def resolve_events(self, info, **kwargs):

events = [
Event(name="Live Show", tags=["concert", "music", "rock"],),
Event(name="Musical", tags=["movie", "music"],),
Event(name="Ballet", tags=["concert", "dance"],),
Event(name="Speech", tags=[],),
Event(name="Live Show", tags=["concert", "music", "rock"]),
Event(name="Musical", tags=["movie", "music"]),
Event(name="Ballet", tags=["concert", "dance"]),
Event(name="Speech", tags=[]),
]

STORE["events"] = events
Expand Down
14 changes: 10 additions & 4 deletions graphene_django/filter/tests/test_enum_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def reporter_article_data():
first_name="Jane", last_name="Doe", email="janedoe@example.com", a_choice=2
)
Article.objects.create(
headline="Article Node 1", reporter=john, editor=john, lang="es",
headline="Article Node 1", reporter=john, editor=john, lang="es"
)
Article.objects.create(
headline="Article Node 2", reporter=john, editor=john, lang="en",
headline="Article Node 2", reporter=john, editor=john, lang="en"
)
Article.objects.create(
headline="Article Node 3", reporter=jane, editor=jane, lang="en",
headline="Article Node 3", reporter=jane, editor=jane, lang="en"
)


Expand All @@ -80,7 +80,13 @@ def test_filter_enum_on_connection(schema, reporter_article_data):
}
"""

expected = {"allArticles": {"edges": [{"node": {"headline": "Article Node 1"}},]}}
expected = {
"allArticles": {
"edges": [
{"node": {"headline": "Article Node 1"}},
]
}
}

result = schema.execute(query)
assert not result.errors
Expand Down
16 changes: 13 additions & 3 deletions graphene_django/filter/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ class Query(ObjectType):
}
}

result = schema.execute(query, variable_values={"email": reporter_1.email},)
result = schema.execute(query, variable_values={"email": reporter_1.email})

assert not result.errors
assert result.data == expected
Expand Down Expand Up @@ -1265,13 +1265,23 @@ class Query(ObjectType):
result = schema.execute(query, variables={"filter": "Ja"})
assert not result.errors
assert result.data == {
"people": {"edges": [{"node": {"name": "Jack"}}, {"node": {"name": "Jane"}},]}
"people": {
"edges": [
{"node": {"name": "Jack"}},
{"node": {"name": "Jane"}},
]
}
}

result = schema.execute(query, variables={"filter": "o"})
assert not result.errors
assert result.data == {
"people": {"edges": [{"node": {"name": "Joe"}}, {"node": {"name": "Bob"}},]}
"people": {
"edges": [
{"node": {"name": "Joe"}},
{"node": {"name": "Bob"}},
]
}
}


Expand Down
12 changes: 3 additions & 9 deletions graphene_django/filter/tests/test_typed_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,9 @@ def test_typed_filter_schema(schema):

def test_typed_filters_work(schema):
reporter = Reporter.objects.create(first_name="John", last_name="Doe", email="")
Article.objects.create(
headline="A", reporter=reporter, editor=reporter, lang="es",
)
Article.objects.create(
headline="B", reporter=reporter, editor=reporter, lang="es",
)
Article.objects.create(
headline="C", reporter=reporter, editor=reporter, lang="en",
)
Article.objects.create(headline="A", reporter=reporter, editor=reporter, lang="es")
Article.objects.create(headline="B", reporter=reporter, editor=reporter, lang="es")
Article.objects.create(headline="C", reporter=reporter, editor=reporter, lang="en")

query = "query { articles (lang_In: [ES]) { edges { node { headline } } } }"

Expand Down
4 changes: 3 additions & 1 deletion graphene_django/filter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def get_filtering_args_from_filterset(filterset_class, type):
field_type = graphene.List(field_type)

args[name] = graphene.Argument(
field_type, description=filter_field.label, required=required,
field_type,
description=filter_field.label,
required=required,
)

return args
Expand Down
16 changes: 13 additions & 3 deletions graphene_django/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,11 @@ class Query(graphene.ObjectType):
result = schema.execute(query)
assert not result.errors
expected = {
"allReporters": {"edges": [{"node": {"firstName": "Some", "lastName": "Guy"}},]}
"allReporters": {
"edges": [
{"node": {"firstName": "Some", "lastName": "Guy"}},
]
}
}
assert result.data == expected

Expand Down Expand Up @@ -1521,7 +1525,9 @@ class Query(graphene.ObjectType):
assert not result.errors
expected = {
"allReporters": {
"edges": [{"node": {"firstName": "Some", "lastName": "Lady"}},]
"edges": [
{"node": {"firstName": "Some", "lastName": "Lady"}},
]
}
}
assert result.data == expected
Expand Down Expand Up @@ -1590,7 +1596,11 @@ class Query(graphene.ObjectType):
result = schema.execute(query, variable_values=dict(after=after))
assert not result.errors
expected = {
"allReporters": {"edges": [{"node": {"firstName": "Jane", "lastName": "Roe"}},]}
"allReporters": {
"edges": [
{"node": {"firstName": "Jane", "lastName": "Roe"}},
]
}
}
assert result.data == expected

Expand Down
2 changes: 1 addition & 1 deletion graphene_django/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __init_subclass_with_meta__(
"Creating a DjangoObjectType without either the `fields` "
"or the `exclude` option is deprecated. Add an explicit `fields "
"= '__all__'` option on DjangoObjectType {class_name} to use all "
"fields".format(class_name=cls.__name__,),
"fields".format(class_name=cls.__name__),
DeprecationWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/utils/tests/test_str_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ def test_to_const():


def test_to_const_unicode():
assert to_const(u"Skoða þetta unicode stöff") == "SKODA_THETTA_UNICODE_STOFF"
assert to_const("Skoða þetta unicode stöff") == "SKODA_THETTA_UNICODE_STOFF"
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@


tests_require = [
"pytest>=3.6.3",
"pytest>=7.1.3",
"pytest-cov",
"pytest-random-order",
"coveralls",
"mock",
"pytz",
"django-filter>=2",
"pytest-django>=3.3.2",
"django-filter>=22.1",
"pytest-django>=4.5.2",
] + rest_framework_require


dev_requires = [
"black==19.10b0",
"flake8==3.7.9",
"flake8-black==0.1.1",
"flake8-bugbear==20.1.4",
"black==22.8.0",
"flake8==5.0.4",
"flake8-black==0.3.3",
"flake8-bugbear==22.9.11",
] + tests_require

setup(
Expand Down Expand Up @@ -61,8 +61,8 @@
packages=find_packages(exclude=["tests", "examples", "examples.*"]),
install_requires=[
"graphene>=3.0,<4",
"graphql-core>=3.1.0,<4",
"graphql-relay>=3.1.1,<4",
"graphql-core>=3.2.1,<4",
"graphql-relay>=3.2.0,<4",
"Django>=2.2",
"promise>=2.1",
"text-unidecode",
Expand Down

0 comments on commit 7b92bbb

Please sign in to comment.