-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for REUSE_DB problems #101
base: master
Are you sure you want to change the base?
Conversation
…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.
If this really fixes it, you've made my day! :-) Unfortunately, I've lost the ability to reproduce it. Do you happen to have a reduced (or even non-reduced) test case? |
Well it's solving the problem for me but unfortunately the code base is a clients website. I'll try and extract a configuration which reproduces the problem in the next few days. |
FWIW this is how we solve these things. for conn in connections.all(): conn.close |
Yeah that seems like a much more sensible approach. |
@dcramer Where did you do the On an old project which runs on Django 1.3.1, I just can't figure out why django-nose creates and syncdbs a |
for bug jazzband#76 When REUSE_DB=1, the test suite would end up using the non-test database
I had a look into the specific problem on my machine. The essential problem is that several db backends cache their underlying connection. The nose test runner detects whether a new database is needed by calling
cursor()
on the backend after renaming theNAME
field of the settings dictionary which the backend uses, this fails if the database does not exist, allowing nose to decide to create the database.Unfortunately some backends cache their underlying connection objects so if any code connects to the database (which hasn't been renamed by django-nose yet) before nose does then any subsequent
cursor()
calls will succeed (as they use the cached connection) and nose is unable to detect that the database exists. The attached code fixes that.Fixes #76