Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 Gaynor authored January 24, 2011
1  tests/regressiontests/inspectdb/bug/__init__.py
... ...
@@ -1 +0,0 @@
1  
-
7  tests/regressiontests/inspectdb/bug/models.py
... ...
@@ -1,7 +0,0 @@
1  
-from django.db import models
2  
-
3  
-class People(models.Model):
4  
-    name = models.CharField(max_length=255)
5  
-
6  
-class Message(models.Model):
7  
-    from_field = models.ForeignKey(People, db_column='from_id')
7  tests/regressiontests/inspectdb/models.py
... ...
@@ -1 +1,8 @@
  1
+from django.db import models
1 2
 
  3
+
  4
+class People(models.Model):
  5
+    name = models.CharField(max_length=255)
  6
+
  7
+class Message(models.Model):
  8
+    from_field = models.ForeignKey(People, db_column='from_id')
21  tests/regressiontests/inspectdb/tests.py
... ...
@@ -1,29 +1,14 @@
1  
-import os
2  
-import sys
3 1
 from StringIO import StringIO
4 2
 
5  
-from django.conf import settings
6 3
 from django.core.management import call_command
7  
-from django.db.models.loading import load_app
8 4
 from django.test import TestCase
9 5
 
  6
+
10 7
 class InspectDBTestCase(TestCase):
11  
-    
12  
-    def setUp(self):
13  
-        self.old_sys_path = sys.path[:]
14  
-        sys.path.append(os.path.dirname(os.path.abspath(__file__)))
15  
-        self.old_installed_apps = settings.INSTALLED_APPS
16  
-        settings.INSTALLED_APPS = ('bug',)
17  
-        map(load_app, settings.INSTALLED_APPS)
18  
-        call_command('syncdb', verbosity=0)
19  
-        
20 8
     def test_attribute_name_not_python_keyword(self):
21 9
         out = StringIO()
22 10
         call_command('inspectdb', stdout=out)
23 11
         error_message = "inspectdb generated an attribute name which is a python keyword"
24  
-        self.assertNotIn("from = models.ForeignKey(BugPeople)", out.getvalue(), msg=error_message)
  12
+        self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message)
  13
+        self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
25 14
         out.close()
26  
-        
27  
-    def tearDown(self):
28  
-        settings.INSTALLED_APPS = self.old_installed_apps
29  
-        sys.path = self.old_sys_path

0 notes on commit 09a6363

Please sign in to comment.
Something went wrong with that request. Please try again.