I've recently started using Nose for my unit tests. It's pretty good except that sometimes when an error occurs it prints out the error information in a really weird way. It splits it up into 1 character per line then prints it out with line numbers. Does anyone have any idea how to fix this?
....F...............
======================================================================
FAIL: accounts.tests.testaccountserver.test_create_account_writes_an_account_to_the_store
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tom/envs/myappshare/lib/python2.7/site-packages/nose/case.py", line 187, in runTest
self.test(*self.arg)
File "/media/Shared/Dropbox/jobs/myapp/myappshare/src/accounts/tests/testaccountserver.py", line 102, in test_create_account_writes_an_account_to_the_store
mox.VerifyAll()
File "/home/tom/envs/myappshare/lib/python2.7/site-packages/mox.py", line 286, in VerifyAll
mock_obj._Verify()
File "/home/tom/envs/myappshare/lib/python2.7/site-packages/mox.py", line 506, in _Verify
raise ExpectedMethodCallsError(self._expected_calls_queue)
ExpectedMethodCallsError: Verify: Expected methods never called:
0. V
1. e
2. r
3. i
4. f
5. y
6. :
7.
8. E
9. x
10. p
11. e
12. c
13. t
14. e
15. d
16.
17. m
18. e
And so on for 1346 lines!
EDIT:
It won't let me answer my own question for 8 hours, so I'm editing in the solution I found:
As Aaron Digulla points out the problem is not in nose but in Mox (which I'm using to Mock objects).
Adding this line to the top of str method of ExpectedMethodCallsError in mox.py fixes the problem (or this symptom anyway):
if isinstance(self._expected_methods, str):
self._expected_methods = self._expected_methods.split("\n")
As Aaron Digulla points out the problem is not in nose but in Mox (which I'm using to Mock objects).
Adding this line to the top of str method of ExpectedMethodCallsError in mox.py fixes the problem (or this symptom anyway):
if isinstance(self._expected_methods, basestring):
self._expected_methods = self._expected_methods.split("\n")