Add `flake8-bugbear` to `pre-commit`.
parent
522e4d20bc
commit
4deefc20b7
|
|
@ -29,6 +29,8 @@ repos:
|
||||||
rev: 6.0.0
|
rev: 6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- flake8-bugbear
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.4.0
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ class Migration(migrations.Migration):
|
||||||
field=colorfield.fields.ColorField(
|
field=colorfield.fields.ColorField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default="#E74C3C",
|
default="#E74C3C",
|
||||||
help_text="(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: #3498DB)", # noqa: E501
|
help_text=(
|
||||||
|
"(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, "
|
||||||
|
"green: #2ECC71, blue: #3498DB)"
|
||||||
|
),
|
||||||
max_length=10,
|
max_length=10,
|
||||||
verbose_name="color",
|
verbose_name="color",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,8 @@ class Theme(models.Model):
|
||||||
blank=True,
|
blank=True,
|
||||||
default="#E74C3C",
|
default="#E74C3C",
|
||||||
help_text=_(
|
help_text=_(
|
||||||
"(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, green: #2ECC71, blue: #3498DB)" # noqa: E501
|
"(red: #E74C3C, orange: #E67E22, yellow: #F1C40F, "
|
||||||
|
"green: #2ECC71, blue: #3498DB)"
|
||||||
),
|
),
|
||||||
max_length=10,
|
max_length=10,
|
||||||
verbose_name=_("color"),
|
verbose_name=_("color"),
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class AdminInterfaceModelsTestCase(TestCase):
|
||||||
theme_4 = Theme.objects.create(name="Custom 4", active=True)
|
theme_4 = Theme.objects.create(name="Custom 4", active=True)
|
||||||
theme_5 = Theme.objects.create(name="Custom 5", active=True)
|
theme_5 = Theme.objects.create(name="Custom 5", active=True)
|
||||||
themes = [theme_1, theme_2, theme_3, theme_4, theme_5]
|
themes = [theme_1, theme_2, theme_3, theme_4, theme_5]
|
||||||
for i in range(5):
|
for _ in range(5):
|
||||||
random.shuffle(themes)
|
random.shuffle(themes)
|
||||||
for theme in themes:
|
for theme in themes:
|
||||||
theme.set_active()
|
theme.set_active()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.test.testcases import DatabaseOperationForbidden
|
||||||
|
|
||||||
from admin_interface.models import Theme
|
from admin_interface.models import Theme
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ class AdminInterfaceModelsWithDBRoutingTestCase(TestCase):
|
||||||
assert db_for_theme == "replica"
|
assert db_for_theme == "replica"
|
||||||
|
|
||||||
def test_dbrouter_errors_when_fetching_from_default(self):
|
def test_dbrouter_errors_when_fetching_from_default(self):
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(DatabaseOperationForbidden):
|
||||||
Theme.objects.get_active()
|
Theme.objects.get_active()
|
||||||
|
|
||||||
def test_dbrouter_fetches_db(self):
|
def test_dbrouter_fetches_db(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue