I wrote a simple unit test for a class to test that the constructor
was handling keyword arguments correctly:
obj = Test(a='foo'')
assert obj.a == 'foo

The test passes fine when run alone, but when run with all the other
test in my pylons app, sqlalchemy complains because Test.a is actually
a relation to another mapped object, so when I try to assign a string
to it, it complains that "str object has no attribute
'_sa_instance_state".  This happens because when the entire test
package in my pylons app runs, the sqlalchemy mapping also runs, which
changes the behavior of the class.

I don't want the unit tests for my class Test to have to know about
what kind of object will be stored in Test.a in the actual app.

I can write a script to run my simple tests seperate from the rest of
my app tests that require the SA mapping be done, but I was wondering
if anyone else had a clever solution to this.  I would like to be able
to run through all of my tests with one command.

--

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].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.


Reply via email to