Export to GitHub

spyderlib - issue #1370

Unit tests exceptions in IPython are displayed in its kernel tab


Posted on Apr 28, 2013 by Quick Kangaroo

Hello,

When running unit tests in the ipython console, exceptions are displayed in spyder internal console. This is the case on all linux and windows and with all versions of spyders. (2.1 , 2.2rc, last hg version so far)

You can reproduce the problem with the following steps:

  1. Use the following script: import unittest

class tests(unittest.TestCase):

def test_raise(self):
    print 1 / 0

if name == 'main': unittest.main()

  1. Run the script in an ipython console of spyder's ipython widget

  2. Errors are displayed in spyder's internal console rather than in the current ipython console. If one runs the same script in a standard python console, the exception is correctly displayed in the current console.

Cheers,

Sylvain

E

ERROR: test_raise (main.tests)

Traceback (most recent call last): File "/home/sylvain/Desktop/DevCode/EclipseWorkspace/BLP/DE_optimizer.py", line 6, in test_raise print 1 / 0 ZeroDivisionError: integer division or modulo by zero


Ran 1 test in 0.000s

FAILED (errors=1)

Comment #1

Posted on Apr 30, 2013 by Happy Camel

I've just tested this on Windows 8 and results are the following: 1. running the sample script in a dedicated Python interpreter works as expected 2. running the sample script in the current Python interpreter works as expected too 3. running the sample script in the current IPython client will show the unittest results within the IPython kernel command window (in "Console" plugin) which is not the expected behavior (but these are not shown in the internal console as your reported)

Comment #2

Posted on Apr 30, 2013 by Quick Kangaroo

Correct, I checked in windows XP and you are right. I will give a try at home on Ubuntu tonight just in case because it is the system I used when I reported the bug. Anyway, it is still not the expected behavior. Thanks,

Comment #3

Posted on Apr 30, 2013 by Quick Horse

I think I know how to fix this one: a config option needs to be passed to the kernel so that stderr is displayed directly in the console.

Comment #4

Posted on May 6, 2013 by Quick Kangaroo

Hi Carlos, Do you have a reference on how to pass such an option to a kernel?

Comment #5

Posted on Jun 20, 2013 by Quick Horse

This issue was updated by revision e59398d1399e.

Comment #6

Posted on Feb 16, 2015 by Quick Horse

(No comment was entered for this change.)

Comment #7

Posted on Feb 17, 2015 by Quick Horse

This issue was migrated to https://github.com/spyder-ide/spyder/issues/

The issue number is exactly the same

Comment #8

Posted on Feb 17, 2015 by Quick Horse

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Low Cat-IPythonConsole OpSys-All MS-v2.2.1 Restrict-AddIssueComment-Commit