Hi,
New to the list, have been using pylons for about a week now and I'm massively
impressed with the speed at which I can develop. I'm porting a couple of apps
from straight Myghty+SQLObject to Pylons and it's amazing how trivial this is.
So, onto the problem:
I have a basic pylons structure, courtesy of paster create
--template=pylons, and have sqlobject.dburi set in the development.ini file.
Running paste serve development.ini works fine.
I'm trying to get some unit tests built for the interface.
When I run nosetests as per the documentation, I get errors that suggest
that the model wasn't loaded properly, which I believe is simply because
nosetests doesn't know about the paste config and thus can't properly
instantiate the model.
======================================================================
ERROR: test module billmaster.controllers.error in
/home/jaq/src/billmaster/billmaster.bzr
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jaq/lib/python2.3/nose-0.8.7.2-py2.3.egg/nose/core.py", line 423,
in run
self.setUp()
File "/home/jaq/lib/python2.3/nose-0.8.7.2-py2.3.egg/nose/core.py", line 653,
in setUp
self.module = self.loader._import(self.module_name, self.path)
File "/home/jaq/lib/python2.3/nose-0.8.7.2-py2.3.egg/nose/core.py", line 280,
in _import
return nose.importer._import(name, [path])
File "/home/jaq/lib/python2.3/nose-0.8.7.2-py2.3.egg/nose/importer.py", line
66, in _import
mod = load_module(fqname, fh, filename, desc)
File
"/home/jaq/src/billmaster/billmaster.bzr/billmaster/controllers/error.py", line
1, in ?
from billmaster.lib.base import *
File "/home/jaq/lib/python2.3/Myghty-1.0.1-py2.3.egg/myghty/importer.py",
line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
File "/home/jaq/src/billmaster/billmaster.bzr/billmaster/lib/base.py", line
2, in ?
import billmaster.models as model
File "/home/jaq/lib/python2.3/Myghty-1.0.1-py2.3.egg/myghty/importer.py",
line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
File "/home/jaq/src/billmaster/billmaster.bzr/billmaster/models/__init__.py",
line 13, in ?
from account import Housemate
File "/home/jaq/lib/python2.3/Myghty-1.0.1-py2.3.egg/myghty/importer.py",
line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
File "/home/jaq/src/billmaster/billmaster.bzr/billmaster/models/account.py",
line 14, in ?
Account.createTable(ifNotExists=True)
File "/home/jaq/lib/python2.3/SQLObject-0.7.0-py2.3.egg/sqlobject/main.py",
line 1305, in createTable
conn = connection or cls._connection
File "/home/jaq/lib/python2.3/Pylons-0.8-py2.3.egg/pylons/database.py", line
108, in __get__
self.set_hub()
File "/home/jaq/lib/python2.3/Pylons-0.8-py2.3.egg/pylons/database.py", line
124, in set_hub
dburi = CONFIG.current_conf()['app'].get("%s.dburi" % self.packagename,
None)
TypeError: unsubscriptable object
All the errors after this one warn that BaseController is not defined, which in
my experience has always been caused by a problem with the database behind the
model, i.e. at import the database was not available and thus Python has loaded
the model namespace with no contents.
So, how do people run their functional tests when they have a database backend
to the model?
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---