-
Notifications
You must be signed in to change notification settings - Fork 32
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
Allow BooleanField(null=True) on Django >= 2.1 #38
Changes from all commits
c9a27da
1695845
abc0956
686cba5
afcb5b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import django | ||
from .checker import Checker | ||
from .issue import Issue | ||
|
||
ALLOW_NULL_BOOLEAN = django.VERSION >= (2, 1) | ||
|
||
NOT_NULL_TRUE_FIELDS = [ | ||
'CharField', 'TextField', 'SlugField', | ||
'EmailField', 'UUIDField', 'ImageField', | ||
'FileField', 'FilePathField', 'URLField' | ||
'CharField', 'TextField', 'SlugField', 'EmailField', 'Field', | ||
'UUIDField', 'ImageField', 'FileField' | ||
] | ||
NOT_BLANK_TRUE_FIELDS = ['BooleanField'] | ||
NOT_BLANK_TRUE_FIELDS = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests are failing now, because coverage decreases from 100% to 99% due to tests on I think, let's remove What are your thoughts? |
||
|
||
if not ALLOW_NULL_BOOLEAN: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we do the check for django.VERSION here? Just so that we make it more explicit? |
||
NOT_NULL_TRUE_FIELDS.append('BooleanField') | ||
NOT_BLANK_TRUE_FIELDS.append('BooleanField') | ||
|
||
|
||
class DJ01(Issue): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
[tox] | ||
envlist = py34,py35,py36,py37 | ||
envlist = | ||
clean | ||
django22-py{37,36} | ||
django21-py{37,36,35} | ||
django20-py{36,35,34} | ||
report | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove clean and report from the envlist. We don't want to run coverage for every environment. |
||
|
||
[flake8] | ||
max-line-length = 120 | ||
exclude = tests/fixtures/* | ||
|
||
[testenv] | ||
deps = pytest | ||
commands = | ||
deps = | ||
pytest | ||
pytest-cov | ||
django20: {[django]2.0.x} | ||
django21: {[django]2.1.x} | ||
django22: {[django]2.2.x} | ||
|
||
commands = | ||
py.test --cov=./flake8_django --cov-append | ||
|
||
[testenv:clean] | ||
deps = coverage | ||
skip_install = true | ||
commands = coverage erase | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This clean part is not needed. |
||
|
||
[testenv:report] | ||
skip_install = true | ||
deps = coverage | ||
commands = | ||
coverage report --fail-under=100 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This report part is not needed, since coverage reports are being uploaded to codecov. |
||
|
||
[django] | ||
2.0.x = Django>=2.0,<2.1 | ||
2.1.x = Django>=2.1,<2.2 | ||
2.2.x = Django>=2.2,<2.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of removing this code, let's create a requirements/test.txt and add Django as a requirements for tests.