Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DST should work with TransactionMiddleware #14

Open
Almad opened this issue Jan 18, 2011 · 0 comments
Open

DST should work with TransactionMiddleware #14

Almad opened this issue Jan 18, 2011 · 0 comments

Comments

@Almad
Copy link
Owner

Almad commented Jan 18, 2011

When exception occurs in tests and transactino middleware is enabled, panda is sad:

======================================================================
ERROR: tests.test_particular_formsxxx


Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/nose/case.py", line 187, in runTest
self.test(_self.arg)
File "/home/lukas.linhart/projects/isis-all/jiskreni/tests/test_particular_forms.py", line 77, in test_zodiac_rendered
HTTP_X_REQUESTED_WITH='XMLHttpRequest'
File "/home/lukas.linhart/projects/isis-all/lib/python2.6/site-packages/django/test/client.py", line 330, in post
response = self.request(__r)
File "/home/lukas.linhart/projects/isis-all/lib/python2.6/site-packages/django/core/handlers/base.py", line 100, in get_response
response = callback(request, *callback_args, *_callback_kwargs)
File "/home/lukas.linhart/projects/isis-all/lib/python2.6/site-packages/django/utils/decorators.py", line 76, in _wrapped_view
response = view_func(request, _args, *_kwargs)
File "/home/lukas.linhart/projects/isis-all/isis/isis/accounts/views.py", line 131, in profile_form
'data' : form.as_data_json(profile=profile)
File "/home/lukas.linhart/projects/isis-all/isis/isis/accounts/forms.py", line 185, in as_data_json
data[name] = self.transform_value(field, data[name])
File "/home/lukas.linhart/projects/isis-all/isis/isis/accounts/forms.py", line 170, in transform_value
return self.field_renderers[field.class](field, value)
File "/home/lukas.linhart/projects/isis-all/isis/isis/accounts/forms.py", line 146, in
forms.ChoiceField : lambda f, v: dict(f.choices)[smart_str(v)],
KeyError: '1'

======================================================================
ERROR: tests.test_particular_forms.xxx


Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/nose/case.py", line 133, in run
self.runTest(result)
File "/usr/lib64/python2.6/site-packages/nose/case.py", line 151, in runTest
test(result)
File "/usr/lib/python2.6/unittest.py", line 300, in call
return self.run(_args, *_kwds)
File "/usr/lib/python2.6/unittest.py", line 297, in run
result.stopTest(self)
File "/usr/lib64/python2.6/site-packages/nose/proxy.py", line 169, in stopTest
self.plugins.stopTest(self.test)
File "/usr/lib64/python2.6/site-packages/nose/plugins/manager.py", line 94, in call
return self.call(_arg, *_kw)
File "/usr/lib64/python2.6/site-packages/nose/plugins/manager.py", line 162, in simple
result = meth(_arg, *_kw)
File "/home/lukas.linhart/projects/isis-all/lib/python2.6/site-packages/djangosanetesting/noseplugins.py", line 478, in stopTest
transaction.leave_transaction_management()
File "/home/lukas.linhart/projects/isis-all/lib/python2.6/site-packages/django/db/transaction.py", line 84, in leave_transaction_management
raise TransactionManagementError("This code isn't under transaction management")
TransactionManagementError: This code isn't under transaction management


Ran 12 tests in 29.339s

Either disable middleware (not goot, IMO, as we then could not test transactions), or handle rollback better, and/or do arrangements in plugin (we cannot have reliable non-destructive tests then...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant