Skip to content

Commit e560f40

Browse files
committed
Add migrations test for Django 1.7+
1 parent 1a06ee6 commit e560f40

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
.DS_Store
88
/.coverage
99
/htmlcov/
10+
migrations/
1011
/.tox/

django_enumfield/tests/test_enum.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import django
2+
from django.core.management import call_command
13
from django.test.client import RequestFactory
24
from django.db import IntegrityError
35
from django.forms import ModelForm, TypedChoiceField
@@ -120,6 +122,10 @@ class Meta:
120122
self.assertEqual(form.fields['state'].choices[2][1].label, 'STALE')
121123
self.assertEqual(form.fields['state'].choices[3][1].label, 'EMPTY')
122124

125+
def test_migration(self):
126+
if django.VERSION >= (1, 7):
127+
call_command('makemigrations', 'tests')
128+
123129

124130
class EnumTest(TestCase):
125131
def test_label(self):

run_tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/usr/bin/env python
22

3+
import os
34
import sys
45
import django
56
from django.conf import settings
67

78

89
def main():
10+
11+
from os.path import exists, abspath, dirname, join
12+
migrations_dir = join(
13+
dirname(abspath(__file__)), 'django_enumfield', 'tests', 'migrations')
14+
if exists(migrations_dir):
15+
os.system('rm -r ' + migrations_dir)
16+
917
if not settings.configured:
1018
# Dynamically configure the Django settings with the minimum necessary to
1119
# get Django running tests

0 commit comments

Comments
 (0)