Hi all,
I'm wondering how do you test a model with sqlalchemy.
I don't think I'm the only one to try to test his model with 
sqlalchemy but I didn't find help on the ML.

Here are some info:

* TurboGears 1.0.1
* configobj 4.3.2
* RuleDispatch 0.5a0.dev-r2115
* setuptools 0.6c3
* FormEncode 0.6
* cElementTree 1.0.5-20051216
* PasteScript 1.0
* elementtree 1.2.6-20050316
* simplejson 1.4
* CherryPy 2.2.1
* TurboKid 0.9.9
* TurboCheetah 0.9.5
* TurboJson 0.9.9
* PyProtocols 1.0a0
* Cheetah 2.0rc7
* PasteDeploy 1.0
* Paste 1.0
* kid 0.9.4
* Cheetah 2.0rc7
* elementtree 1.2.6-20050316

Identity Providers

* sqlobject (TurboGears 1.0.1)
* sqlalchemy (TurboGears 1.0.1)
(...)
Visit Managers

* sqlobject (TurboGears 1.0.1)
* sqlalchemy (TurboGears 1.0.1)
(...)

when I run this test :

from turbogears import testutil, database
from facturator.model import User

database.set_db_uri("sqlite:///:memory:")

class TestUser(testutil.DBTest):
    def get_model(self):
        return User

    def test_creation(self):
        "Object creation should set the name"
        obj = User(user_name = "creosote",
                   email_address = "[EMAIL PROTECTED]",
                   display_name = "Mr Creosote",
                   password = "Wafer-thin Mint")
        assert obj.display_name == "Mr Creosote"

I get :

Traceback (most recent call last):
  File "/usr/lib64/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/
turbogears/testutil.py", line 164, in setUp
    sqlobject.SQLObject) and item != sqlobject.SQLObject \
TypeError: issubclass() arg 1 must be a class

I saw that it's a well known bug, and Jorge Vargas said here ( http://
groups.google.com/group/turbogears/browse_thread/thread/
9551c671694c02a6/b075daef067232af?lnk=gst&q=sqlalchemy
+nose&rnum=7#b075daef067232af)
TestGears is deprecated.

Okay, I've tried without it, and I get :
(...)
 File "/usr/lib64/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/
turbogears/database.py", line 39, in get_engine
    dburi = alch_args.pop('dburi')
KeyError: 'pop(): dictionary is empty'

If I look to the conf, before the test, I've :
[('autoreload.on', False), ('sqlobject.dburi', 'sqlite:///:memory:'), 
('server.thread_pool', 10), ('server.socket_queue_size', 5), 
('server.log_file', ''), ('server.socket_port', 8080), 
('tg.new_style_logging', True), ('server.log_tracebacks', True), 
('server.reverse_dns', False), ('cherrypy_started', True), 
('server.socket_host', ''), ('server.protocol_version', 'HTTP/1.0'), 
('server.environment', 'development'), ('server.log_to_screen', True), 
('server.socket_file', '')]

Huhu ?!? Where is the sqlalchemy conf ?

If someone can post a simple (working) test_model with sqlalchemy, it 
would be greatly appreciated.

I'm sorry for the length and I hope it wasn't (already) answered

Nicolas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to