Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify the tests for [15296].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 09a63632c5072695d3b3293a046c197ea3c3299a 1 parent bafe879
@alex alex authored
View
1  tests/regressiontests/inspectdb/bug/__init__.py
@@ -1 +0,0 @@
-
View
7 tests/regressiontests/inspectdb/bug/models.py
@@ -1,7 +0,0 @@
-from django.db import models
-
-class People(models.Model):
- name = models.CharField(max_length=255)
-
-class Message(models.Model):
- from_field = models.ForeignKey(People, db_column='from_id')
View
7 tests/regressiontests/inspectdb/models.py
@@ -1 +1,8 @@
+from django.db import models
+
+class People(models.Model):
+ name = models.CharField(max_length=255)
+
+class Message(models.Model):
+ from_field = models.ForeignKey(People, db_column='from_id')
View
21 tests/regressiontests/inspectdb/tests.py
@@ -1,29 +1,14 @@
-import os
-import sys
from StringIO import StringIO
-from django.conf import settings
from django.core.management import call_command
-from django.db.models.loading import load_app
from django.test import TestCase
+
class InspectDBTestCase(TestCase):
-
- def setUp(self):
- self.old_sys_path = sys.path[:]
- sys.path.append(os.path.dirname(os.path.abspath(__file__)))
- self.old_installed_apps = settings.INSTALLED_APPS
- settings.INSTALLED_APPS = ('bug',)
- map(load_app, settings.INSTALLED_APPS)
- call_command('syncdb', verbosity=0)
-
def test_attribute_name_not_python_keyword(self):
out = StringIO()
call_command('inspectdb', stdout=out)
error_message = "inspectdb generated an attribute name which is a python keyword"
- self.assertNotIn("from = models.ForeignKey(BugPeople)", out.getvalue(), msg=error_message)
+ self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message)
+ self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
out.close()
-
- def tearDown(self):
- settings.INSTALLED_APPS = self.old_installed_apps
- sys.path = self.old_sys_path
Please sign in to comment.
Something went wrong with that request. Please try again.