Permalink
Browse files

Fix obscure "'SkipDatabaseCreation' object has no attribute '_rollbac…

…k_works'" AttributeError when attempting to run django_nose tests with REUSE_DB=1 on Django trunk (pre-v1.5)

The confirm method has been removed from BaseDatabaseFeatures as cached properties (like "supports_transactions") now confirm their features automagically.
  • Loading branch information...
1 parent 627d896 commit c8366ed9ecdddd44a04d0e4ede334a74f553b13a @dvelyk dvelyk committed with jbalogh Sep 9, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 django_nose/runner.py
View
@@ -234,11 +234,15 @@ def _skip_create_test_db(self, verbosity=1, autoclobber=False):
"""
# Notice that the DB supports transactions. Originally, this was done in
- # the method this overrides. Django v1.2 does not have the confirm
- # function. Added in https://code.djangoproject.com/ticket/12991.
+ # the method this overrides. The confirm method was added in Django v1.3
+ # (https://code.djangoproject.com/ticket/12991) but removed in Django v1.5
+ # (https://code.djangoproject.com/ticket/17760). In Django v1.5
+ # supports_transactions is a cached property evaluated on access.
if callable(getattr(self.connection.features, 'confirm', None)):
+ # Django v1.3-4
self.connection.features.confirm()
- else:
+ elif hasattr(self, "_rollback_works"):
+ # Django v1.2 and lower
can_rollback = self._rollback_works()
self.connection.settings_dict['SUPPORTS_TRANSACTIONS'] = can_rollback

0 comments on commit c8366ed

Please sign in to comment.