Skip to content

Update flake8 #688

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

Merged
merged 5 commits into from
Jun 24, 2019
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test: tests # Alias test -> tests

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

.PHONY: lint
lint:
Expand Down
4 changes: 3 additions & 1 deletion graphene_django/filter/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,14 @@ class Query(ObjectType):
pub_date=datetime.now(),
pub_date_time=datetime.now(),
reporter=r1,
editor=r1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems out of place, but I am also not sure how Articles were being created with a null editor....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zbyte64 flake8 raised the fact that this test name was the same as another one further down the file and so it was never being run. So when I renamed that test (https://github.com/graphql-python/graphene-django/pull/688/files#diff-42247536fb4398767212e74574263a3bR455) this one started failing because of the missing editor param.

)
Article.objects.create(
headline="a2",
pub_date=datetime.now(),
pub_date_time=datetime.now(),
reporter=r2,
editor=r2,
)

query = """
Expand Down Expand Up @@ -450,7 +452,7 @@ class Meta:
assert multiple_filter.field_class == GlobalIDMultipleChoiceField


def test_filter_filterset_related_results():
def test_filter_filterset_related_results_with_filter():
class ReporterFilterNode(DjangoObjectType):
class Meta:
model = Reporter
Expand Down
2 changes: 1 addition & 1 deletion graphene_django/rest_framework/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init_subclass_with_meta__(
lookup_field=None,
serializer_class=None,
model_class=None,
model_operations=["create", "update"],
model_operations=("create", "update"),
only_fields=(),
exclude_fields=(),
**options
Expand Down
27 changes: 26 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,33 @@ test=pytest
universal=1

[flake8]
exclude = setup.py,docs/*,examples/*,tests,graphene_django/debug/sql/*
exclude = docs,graphene_django/debug/sql/*,migrations
max-line-length = 120
select =
# Dictionary key repeated
F601,
# Ensure use of ==/!= to compare with str, bytes and int literals
F632,
# Redefinition of unused name
F811,
# Using an undefined variable
F821,
# Defining an undefined variable in __all__
F822,
# Using a variable before it is assigned
F823,
# Duplicate argument in function declaration
F831,
# Black would format this line
BLK,
# Do not use bare except
B001,
# Don't allow ++n. You probably meant n += 1
B002,
# Do not use mutable structures for argument defaults
B006,
# Do not perform calls in argument defaults
B008

[coverage:run]
omit = */tests/*
Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
dev_requires = [
"black==19.3b0",
"flake8==3.7.7",
"flake8-black==0.1.0",
"flake8-bugbear==19.3.0",
] + tests_require

setup(
Expand Down Expand Up @@ -64,7 +66,11 @@
setup_requires=["pytest-runner"],
tests_require=tests_require,
rest_framework_require=rest_framework_require,
extras_require={"test": tests_require, "rest_framework": rest_framework_require, "dev": dev_requires},
extras_require={
"test": tests_require,
"rest_framework": rest_framework_require,
"dev": dev_requires,
},
include_package_data=True,
zip_safe=False,
platforms="any",
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ commands = {posargs:py.test --cov=graphene_django graphene_django examples}

[testenv:black]
basepython = python3.7
deps = black
deps = -e.[dev]
commands =
black --exclude "/migrations/" graphene_django examples --check
black --exclude "/migrations/" graphene_django examples setup.py --check

[testenv:flake8]
basepython = python3.7
deps = flake8
deps = -e.[dev]
commands =
flake8 graphene_django examples