Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Python 2.3 compatibility: Fixed a test to only run under 2.4+, since …

…it fails due to a Ptyhon problem under 2.3.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5f1ecdc51ab9a55e8155fae9026783ab76c9c8c2 1 parent 33f097e
Karen Tracey authored April 27, 2010
15  tests/regressiontests/admin_scripts/tests.py
@@ -531,7 +531,7 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
531 531
     A series of tests for django-admin.py when the settings file is in a
532 532
     directory. (see #9751).
533 533
     """
534  
-    
  534
+
535 535
     def setUp(self):
536 536
         self.write_settings('settings', is_dir=True)
537 537
 
@@ -973,10 +973,15 @@ def test_nonexistent_app(self):
973 973
     def test_broken_app(self):
974 974
         "manage.py validate reports an ImportError if an app's models.py raises one on import"
975 975
         self.write_settings('settings.py', apps=['admin_scripts.broken_app'])
976  
-        args = ['validate']
977  
-        out, err = self.run_manage(args)
978  
-        self.assertNoOutput(out)
979  
-        self.assertOutput(err, 'ImportError')
  976
+        # Skip this test on Python 2.3, where a 2nd attempt to import a broken module won't raise
  977
+        # an error. Due to the way models modules are loaded and re-tried if the first attempt
  978
+        # fails, Django needs the 2nd attempt to fail, but on Python 2.3 that does not happen, thus
  979
+        # this function only works on higher levels of Python.
  980
+        if sys.version_info >= (2, 4):
  981
+            args = ['validate']
  982
+            out, err = self.run_manage(args)
  983
+            self.assertNoOutput(out)
  984
+            self.assertOutput(err, 'ImportError')
980 985
 
981 986
     def test_complex_app(self):
982 987
         "manage.py validate does not raise an ImportError validating a complex app with nested calls to load_app"

0 notes on commit 5f1ecdc

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