Skip to content

Commit

Permalink
Test Improvements - 2
Browse files Browse the repository at this point in the history
Remove unmaintained flask testing library and improve tests speed by clearing
tables instead of dropping and recreating them between each test. These
changes also help in upgrading the other flask dependencies.
  • Loading branch information
amCap1712 committed Dec 1, 2023
1 parent 158d64c commit 75e193d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
25 changes: 3 additions & 22 deletions critiquebrainz/data/testing.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
import os
from critiquebrainz.frontend.testing import FrontendTestCase

from flask_testing import TestCase

from critiquebrainz.data.utils import create_all, drop_tables, drop_types, clear_tables
from critiquebrainz.frontend import create_app


class DataTestCase(TestCase):

def create_app(self):
app = create_app(config_path=os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'test_config.py'))
return app

def setUp(self):
self.reset_db()
# TODO(roman): Add stuff form fixtures.

def tearDown(self):
pass

@staticmethod
def reset_db():
clear_tables()
class DataTestCase(FrontendTestCase):
pass
1 change: 1 addition & 0 deletions critiquebrainz/frontend/views/test/test_bb_author.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from critiquebrainz.db.user import User
from critiquebrainz.frontend.testing import FrontendTestCase


class AuthorViewsTestCase(FrontendTestCase):

def setUp(self):
Expand Down

0 comments on commit 75e193d

Please sign in to comment.