2 messages in com.googlegroups.pylons-discussurl_for with paste.fixture
FromSent OnAttachments
Max Ischenko29 Jan 2007 01:06 
Ben Bangert30 Jan 2007 20:13 
Subject:url_for with paste.fixture
From:Max Ischenko (isch@public.gmane.org)
Date:01/29/2007 01:06:48 AM
List:com.googlegroups.pylons-discuss

Hi,

I run into an interesting issue with paste.fixture and url_for.

I have a simple test case:

class TestQuotesController(TestController): def test_create(self): eq_('/quotes/new;create', url_for(controller='quotes', action='create'))

If I run nosetests on the file where it is defined all is fine and test passes. If I run a whole test suite I got an error in the test case:

FAIL: test_create (doupy.tests.functional.test_quotes.TestQuotesController) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/max/projects/dou-trunk/site/doupy/doupy/tests/functional/ test_quotes.py", line 7, in test_create eq_('/quotes/new;create', url_for(controller='quotes', action='create')) File "/usr/lib/python2.4/site-packages/nose-0.9.1-py2.4.egg/nose/ tools.py", line 23, in eq_ assert a == b, msg or "%r != %r" % (a, b) AssertionError: '/quotes/new;create' != '/quotes/new;create? name=contacts'

It looks like the "previous state" hasn't been cleared and the 'name' qs arg got passed to the next test case.

My TestController looks like this:

class TestController(TestCase): def __init__(self, *args): wsgiapp = loadapp('config:development.ini', relative_to=conf_dir) self.app = paste.fixture.TestApp(wsgiapp) TestCase.__init__(self, *args)

What should I do to fix the problem?