You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ REUSE_DB=1 ./manage.py test ./nosetest/test.py
nosetests ./nosetest/test.py --verbosity=1
Creating test database for alias 'default'...
Ran 2 tests in 0.019s
$ echo 'drop database test_nosetest;' | ./manage.py dbshell
(dropping the db again so we can see the issue)
So, that works with a single DB. Now try again, with the 2nd DB:
$ ISSUE=1 REUSE_DB=1 ./manage.py test ./nosetest/test.py
nosetests ./nosetest/test.py --verbosity=1
Creating test database for alias 'default'...
Ran 3 tests in 0.252s
$ echo 'drop database test_nosetest;' | ./manage.py dbshell
(dropping the db again so we can see the issue)
Awesome. That also works.
Now we update to django-nose 1.4:
$ REUSE_DB=1 ./manage.py test ./nosetest/test.py
nosetests ./nosetest/test.py --verbosity=1
Creating test database for alias 'default'...
Ran 2 tests in 0.064s
$ echo 'drop database test_nosetest;' | ./manage.py dbshell
(dropping the db again so we can see the issue)
Yes, without the 2nd DB, it works.
But now we try with the 2nd DB, and we get this:
$ ISSUE=1 REUSE_DB=1 ./manage.py test ./nosetest/test.py
nosetests ./nosetest/test.py --verbosity=1
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
...
File "/home/walter/.virtualenvs/nosetest/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/home/walter/.virtualenvs/nosetest/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1049, "Unknown database 'test_nosetest'")
TLDR: If you "fake" a TEST_MIRROR config, by pointing it to the same database as the original, REUSE_DB is broken since django-nose 1.4.
See this
settings.py
:In django-nose 1.3, the following works fine:
So, that works with a single DB. Now try again, with the 2nd DB:
Awesome. That also works.
Now we update to django-nose 1.4:
Yes, without the 2nd DB, it works.
But now we try with the 2nd DB, and we get this:
The cause is this change:
a893caf
If we remove those two lines, things start working again.
Now, you ask me: why do you point your TEST_MIRROR to the same DB? That's because we use a 2nd DB in production, but not on our dev machines.
Files used for this test:
Note that if we point the 2nd DB to somewhere else, the REUSE_DB works. But then we run into the fact that TEST_MIRROR support is unavailable.
The text was updated successfully, but these errors were encountered: