1
0
Fork 0

Use setUpTestData() to speed up tests

Pylint's `bad-classmethod-argument` is disabled for each definition
to avoid rewriting the method bodies just to rename `self` → `cls`.
This can be done gradually, as the setUpTestData methods are modified
along the way.
This commit is contained in:
Adeodato Simó 2023-11-30 02:56:16 -03:00
parent cf1afefc84
commit 9d502f5ee2
No known key found for this signature in database
GPG key ID: CDF447845F1A986F
129 changed files with 644 additions and 327 deletions

View file

@ -14,10 +14,9 @@ from bookwyrm.tests.validate_html import validate_html
class InviteViews(TestCase):
"""every response to a get request, html or json"""
# pylint: disable=invalid-name
def setUp(self):
@classmethod
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
"""we need basic test data and mocks"""
self.factory = RequestFactory()
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch(
"bookwyrm.activitystreams.populate_stream_task.delay"
), patch("bookwyrm.lists_stream.populate_lists_task.delay"):
@ -30,6 +29,10 @@ class InviteViews(TestCase):
)
models.SiteSettings.objects.create()
def setUp(self):
"""individual test setup"""
self.factory = RequestFactory()
def test_invite_page(self):
"""there are so many views, this just makes sure it LOADS"""
view = views.Invite.as_view()