-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Fixed #14415 -- Do not ignore DB test name setting #6536
Conversation
Modified the code so it will take DATABASES['db-name']['TEST']['NAME'] into account while it decides which databases to create for tests. Using this setting is essential when testing with different tables in different databases
Did you consider trying to write a test for this change? If not, did you try testing it manually? |
I did consider, but couldn't think of a standard way to do this.
Before the fix I got Because Django didn't find the second model table on the first DB. It wan't created because it shouldn't be created on the default db, but the second db was not created because Django assumed it is already exists (after ignoring the ['TEST']['NAME'] setting). After the fix the test has passed. |
@boaz85 three points:
Thanks for working on this! |
I changed the code to use get_test_db_name to get the db name for the signature. It behaves exactly like Shai suggested and seems to be cleaner. I didn't find any doc that should be updated. After all - this is a bug fix and not a new feature, right? Should I update the latest version (1.9.6) release file? |
I think a test something like this might be feasible:
You might be able to do this more elegantly if you look at This isn't a critical fix or a regression from earlier versions of Django, so it won't be backported to 1.9. |
c511da2
to
c5edb12
Compare
Added regression tests. They all fail without the fix and pass with it. |
merged in 5f23f90, thanks! |
Modified the code so it will take DATABASES['db-name']['TEST']['NAME'] into account while it decides which databases to create for tests. Using this setting is essential when testing with different tables in different databases