i don't now why, but from one day to another y started to have problems when i tried to run the tests. I'm using django 1.1 (customer requirements) and when i running test whith:
python manage.py test --setting=settingsTest
it throw:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 362, in execute_manager
...
File "/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py", line 193, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: programas_act_actividadesprograma
but i have in settingsTest.py
INSTALLED_APPS = (
'django.contrib.auth',
...
'site.programas_act',
...
)
and in /var/www/site/programas_act/models.py
class ActividadesPrograma(models.Model):
...
I removed the file named in settingsTest.DATABASE_NAME and run:
python manage.py syncdb --setting=settingsTest
but still failing.
If i run in django shell_plus:
import settings
print settings.INSTALLED_APPS
for app in settings.INSTALLED_APPS:
print app
I can see the app, but when i run:
from django.db import connection
cursor = connection.cursor()
qry="""SELECT name FROM sqlite_master
WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%'
UNION ALL
SELECT name FROM sqlite_temp_master
WHERE type IN ('table','view')
ORDER BY 1"""
cursor.execute(qry)
results = cursor.fetchall()
for tablename in results:
print tablename
I can't found that tablename.
Anyone can help me?
Thanks
I had this problem, too. Turned out that I had to add a TEST_NAME property in the settings.py file to identify the test database properly. It solved the problem for me:
if 'test' in sys.argv:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(os.path.dirname(__file__), 'test.db'),
'TEST_NAME': os.path.join(os.path.dirname(__file__), 'test.db'),
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With