Skip to content

Commit 4a80395

Browse files
committed
Removed support for perma_fixtures, using the blobal test fixtures instead.
- Legacy-Id: 10228
1 parent 199f460 commit 4a80395

3 files changed

Lines changed: 2 additions & 53 deletions

File tree

ietf/nomcom/tests.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def get_cert_files():
4141

4242
class NomcomViewsTest(TestCase):
4343
"""Tests to create a new nomcom"""
44-
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
45-
perma_fixtures = ['nomcom_templates']
4644

4745
def check_url_status(self, url, status):
4846
response = self.client.get(url)
@@ -745,8 +743,6 @@ def feedback_view(self, *args, **kwargs):
745743

746744
class NomineePositionStateSaveTest(TestCase):
747745
"""Tests for the NomineePosition save override method"""
748-
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
749-
perma_fixtures = ['nomcom_templates']
750746

751747
def setUp(self):
752748
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")
@@ -786,7 +782,6 @@ def test_nomine_position_unique(self):
786782

787783

788784
class FeedbackTest(TestCase):
789-
perma_fixtures = ['nomcom_templates']
790785

791786
def setUp(self):
792787
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")
@@ -823,7 +818,6 @@ def test_encrypted_comments(self):
823818
self.assertEqual(check_comments(feedback.comments, comments, self.privatekey_file), True)
824819

825820
class ReminderTest(TestCase):
826-
perma_fixtures = ['nomcom_templates']
827821

828822
def setUp(self):
829823
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")

ietf/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def skip_unreadable_post(record):
322322
TEST_RUNNER = 'ietf.utils.test_runner.IetfTestRunner'
323323

324324
# Fixtures which will be loaded before testing starts
325-
GLOBAL_TEST_FIXTURES = [ 'names','ietf.utils.test_data.make_immutable_base_data' ]
325+
GLOBAL_TEST_FIXTURES = [ 'names','ietf.utils.test_data.make_immutable_base_data','nomcom_templates' ]
326326

327327
TEST_DIFF_FAILURE_DIR = "/tmp/test/failure/"
328328

ietf/utils/test_utils.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -269,58 +269,13 @@ def test_redirect_with_lazy_reverse(self):
269269
response = self.client.get('/ipr/update/')
270270
self.assertRedirects(response, "/ipr/", status_code=301)
271271

272-
loaded_fixtures = []
273-
274272
class TestCase(django.test.TestCase):
275273
"""
276-
Does basically the same as django.test.TestCase, but if the test database has
277-
support for transactions, it loads perma_fixtures before the transaction which
278-
surrounds every test. This causes the perma_fixtures to stay in the database
279-
after the transaction which surrounds each test is rolled back, which lets us
280-
load each preload_fixture only once. However, it requires that all the
281-
perma_fixtures are consistent with each other and with all regular fixtures
282-
across all applications. You could view the perma_fixtures as on_the_fly
283-
initial_data for tests.
284-
285-
Regular fixtures are re-loaded for each TestCase, as usual.
286-
287-
We don't flush the database, as that triggers a re-load of initial_data.
274+
Does basically the same as django.test.TestCase, but adds asserts for html5 validation.
288275
"""
289276

290277
parser = html5lib.HTMLParser(strict=True)
291278

292-
def _fixture_setup(self):
293-
global loaded_fixtures
294-
295-
if not connections_support_transactions():
296-
if hasattr(self, 'perma_fixtures'):
297-
if not hasattr(self, 'fixtures'):
298-
self.fixtures = self.perma_fixtures
299-
else:
300-
self.fixtures += self.perma_fixtures
301-
return super(TestCase, self)._fixture_setup()
302-
303-
# If the test case has a multi_db=True flag, setup all databases.
304-
# Otherwise, just use default.
305-
if getattr(self, 'multi_db', False):
306-
databases = connections
307-
else:
308-
databases = [DEFAULT_DB_ALIAS]
309-
310-
for db in databases:
311-
if hasattr(self, 'perma_fixtures'):
312-
fixtures = [ fixture for fixture in self.perma_fixtures if not fixture in loaded_fixtures ]
313-
if fixtures:
314-
call_command('loaddata', *fixtures, **{
315-
'verbosity': 0,
316-
'commit': False,
317-
'database': db
318-
})
319-
loaded_fixtures += fixtures
320-
321-
super(TestCase, self)._fixture_setup()
322-
323-
324279
def assertValidHTML(self, data):
325280
try:
326281
self.parser.parse(data)

0 commit comments

Comments
 (0)