Hello,

I'm trying to get my head around nosetest (along with sqlalchemy,
turbogears and python ;)

I've created a quickstart with sqlalchemy and identity and haven't
made any changes to it except for a few extra tests.

I found a message on the list that pointed to 

http://paste.turbogears.org/paste/950
http://paste.turbogears.org/paste/949

to create the tables and drop them again for each test.

But I stumbled upon a test that fails with nosetest, but works
perfectly from a shell.

This first test works.

    def test_by_email_address(self):
        "test by_email_address"
        u = create_user()
        session.flush()
        u2 = User.by_email_address("[EMAIL PROTECTED]")
        assert u2.display_name == "test user"

This second test fails, with
AttributeError: 'NoneType' object has no attribute 'display_name'

    def test_by_user_name(self):
        "test by_user_name"
        u = create_user()
        session.flush()
        u2 = User.by_user_name("test_user")
        assert u2.display_name == "test user"

To make things even weirder, this third test fails, with that same
error as above. It's basically the same test as the first one that
works.

    def test_by_user_name2(self):
        u3 = User(user_name = "testuser2",
                      email_address = "[EMAIL PROTECTED]",
                      display_name = "testuser2",
                      password = "Wafer-thin Mint")
        session.flush()
        u2 = User.by_email_address("[EMAIL PROTECTED]")
        assert u2.display_name == "testuser2"
        
On the shell, if I create a new user object, session.flush()
I can use User.by_email_address and User.by_user_name
successfully.

Any ideas?


>  LocalWords:  AttributeError NoneType

--~--~---------~--~----~------------~-------~--~----~
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