Note that there are some explanatory texts on larger screens.

plurals
  1. POPython nose tests (actually the error is from Mox) print out errors one character per line (with line numbers!)
    text
    copied!<p>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?</p> <pre><code>....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 </code></pre> <p>And so on for 1346 lines! </p> <p>EDIT:</p> <p>It won't let me answer my own question for 8 hours, so I'm editing in the solution I found:</p> <p>As Aaron Digulla points out the problem is not in nose but in Mox (which I'm using to Mock objects).</p> <p>Adding this line to the top of <em>str</em> method of ExpectedMethodCallsError in mox.py fixes the problem (or this symptom anyway):</p> <pre><code>if isinstance(self._expected_methods, str): self._expected_methods = self._expected_methods.split("\n") </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload