Skip to content

Commit 145299d

Browse files
committed
Fix test_initial_south_migrations, add test_initial_without_south_migrations
1 parent 3beb888 commit 145299d

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/test_db_setup.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,32 @@ def test_inner_south():
325325
testdir.create_initial_south_migration()
326326

327327
result = testdir.runpytest('--tb=short', '-v', '-s')
328-
assert result.ret != 0
329-
result.stderr.fnmatch_lines(['*no such table: app_item*'])
328+
assert result.ret == 0
330329
result.stdout.fnmatch_lines(['*mark_south_migration_forwards*'])
331330

331+
@pytest.mark.django_project(extra_settings="""
332+
INSTALLED_APPS += [ 'south', ]
333+
SOUTH_TESTS_MIGRATE = True
334+
SOUTH_MIGRATION_MODULES = {
335+
'app': 'tpkg.app.south_migrations',
336+
}
337+
""")
338+
def test_initial_without_south_migrations(self, django_testdir_initial):
339+
"""Using South, but without any migrations should still load the
340+
initial data."""
341+
django_testdir_initial.create_test_module('''
342+
import pytest
343+
344+
@pytest.mark.django_db
345+
def test_inner_south():
346+
pass
347+
''')
348+
349+
result = django_testdir_initial.runpytest('--tb=short', '-v', '-s')
350+
assert result.ret == 0
351+
result.stdout.fnmatch_lines(['*PASSED*'])
352+
assert 'mark_south_migration_forwards' not in result.stdout.str()
353+
332354
@pytest.mark.django_project(extra_settings="""
333355
INSTALLED_APPS += [ 'south', ]
334356
SOUTH_TESTS_MIGRATE = True

0 commit comments

Comments
 (0)