zonca/pytest-ipynb

broken with ipython 3.0

oz123 opened this issue · 9 comments

oz123 commented

IPython 3.0 is not working with this code. Here is the output I get running the demo notebook:

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/pytest_ipynb/plugin.py:52: AttributeError
__________________________________________________________________________________________________ ERROR at setup of cell 4: failing test __________________________________________________________________________________________________

self = <CallInfo when='setup' exception: 'ZMQSocketChannel' object has no attribute 'execute'>, func = <function <lambda> at 0x22c7a28>, when = 'setup'

    def __init__(self, func, when):
        #: context of invocation: one of "setup", "call",
        #: "teardown", "memocollect"
        self.when = when
        self.start = time()
        try:
>           self.result = func()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   return CallInfo(lambda: ihook(item=item, **kwds), when=when)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <HookCaller 'pytest_runtest_setup'>
kwargs = {'__multicall__': <MultiCall 0 results, 1 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <IPyNbCell 'tests/test_series_plots.ipynb'>}

    def __call__(self, **kwargs):
>       return self._docall(self.methods, kwargs)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:521: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <HookCaller 'pytest_runtest_setup'>
methods = [<function pytest_runtest_setup at 0x13e0d70>, <function pytest_runtest_setup at 0x12c3488>, <function pytest_runtest_...13bb578>, <bound method CaptureManager.pytest_runtest_setup of <_pytest.capture.CaptureManager instance at 0x20d5440>>]
kwargs = {'__multicall__': <MultiCall 0 results, 1 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>, 'item': <IPyNbCell 'tests/test_series_plots.ipynb'>}

    def _docall(self, methods, kwargs):
        return MultiCall(methods, kwargs,
>                        firstresult=self.firstresult).execute()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:528: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MultiCall 0 results, 1 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>

    def execute(self):
        all_kwargs = self.kwargs
        while self.methods:
            method = self.methods.pop()
            args = [all_kwargs[argname] for argname in varnames(method)]
            if hasattr(method, "hookwrapper"):
>               return wrapped_call(method(*args), self.execute)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:393: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

wrap_controller = <generator object pytest_runtest_setup at 0x2223c30>
func = <bound method MultiCall.execute of <MultiCall 0 results, 1 meths, kwargs={'ite...plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>>

    def wrapped_call(wrap_controller, func):
        """ Wrap calling to a function with a generator which needs to yield
        exactly once.  The yield point will trigger calling the wrapped function
        and return its CallOutcome to the yield point.  The generator then needs
        to finish (raise StopIteration) in order for the wrapped call to complete.
        """
        try:
            next(wrap_controller)   # first yield
        except StopIteration:
            raise_wrapfail(wrap_controller, "did not yield")
        call_outcome = CallOutcome(func)
        try:
            wrap_controller.send(call_outcome)
            raise_wrapfail(wrap_controller, "has second yield")
        except StopIteration:
            pass
>       return call_outcome.get_result()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:113: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.core.CallOutcome instance at 0x22e0320>

    def get_result(self):
        if self.excinfo is None:
            return self.result
        else:
            ex = self.excinfo
            if py3:
                raise ex[1].with_traceback(ex[2])
>           py.builtin._reraise(*ex)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.core.CallOutcome instance at 0x22e0320>, func = <bound method MultiCall.execute of <MultiCall 0 results, 1 meths, kwargs={'ite...plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>>

    def __init__(self, func):
        try:
>           self.result = func()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:123: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MultiCall 0 results, 1 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 1 meths, kwargs={...}>}>

    def execute(self):
        all_kwargs = self.kwargs
        while self.methods:
            method = self.methods.pop()
            args = [all_kwargs[argname] for argname in varnames(method)]
            if hasattr(method, "hookwrapper"):
                return wrapped_call(method(*args), self.execute)
>           res = method(*args)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:394: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <IPyNbCell 'tests/test_series_plots.ipynb'>

    def pytest_runtest_setup(item):
>       item.session._setupstate.prepare(item)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:86: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>, colitem = <IPyNbCell 'tests/test_series_plots.ipynb'>

    def prepare(self, colitem):
        """ setup objects along the collector chain to the test-method
                and teardown previously setup objects."""
        needed_collectors = colitem.listchain()
        self._teardown_towards(needed_collectors)

        # check if the last collection node has raised an error
        for col in self.stack:
            if hasattr(col, '_prepare_exc'):
>               py.builtin._reraise(*col._prepare_exc)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>, colitem = <IPyNbCell 'tests/test_series_plots.ipynb'>

    def prepare(self, colitem):
        """ setup objects along the collector chain to the test-method
                and teardown previously setup objects."""
        needed_collectors = colitem.listchain()
        self._teardown_towards(needed_collectors)

        # check if the last collection node has raised an error
        for col in self.stack:
            if hasattr(col, '_prepare_exc'):
                py.builtin._reraise(*col._prepare_exc)
        for col in needed_collectors[len(self.stack):]:
            self.stack.append(col)
            try:
>               col.setup()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:403: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <IPyNbFile 'tests/test_series_plots.ipynb'>

    def setup(self):
        self.fixture_cell = None
>       self.kernel = RunningKernel()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/pytest_ipynb/plugin.py:79: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_ipynb.plugin.RunningKernel object at 0x2169e90>

    def __init__(self):
        self.km = KernelManager()
        self.km.start_kernel(stderr=open(os.devnull, 'w'))
        self.kc = self.km.client()
        self.kc.start_channels()
        self.shell = self.kc.shell_channel
>       self.shell.execute("pass")
E       AttributeError: 'ZMQSocketChannel' object has no attribute 'execute'

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/pytest_ipynb/plugin.py:52: AttributeError
________________________________________________________________________________________________ ERROR at teardown of cell 4: failing test _________________________________________________________________________________________________

self = <CallInfo when='teardown' exception: 'IPyNbFile' object has no attribute 'kernel'>, func = <function <lambda> at 0x2149398>, when = 'teardown'

    def __init__(self, func, when):
        #: context of invocation: one of "setup", "call",
        #: "teardown", "memocollect"
        self.when = when
        self.start = time()
        try:
>           self.result = func()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   return CallInfo(lambda: ihook(item=item, **kwds), when=when)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <HookCaller 'pytest_runtest_teardown'>
kwargs = {'__multicall__': <MultiCall 0 results, 0 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multi...lts, 0 meths, kwargs={...}>, 'nextitem': None}>, 'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, 'nextitem': None}

    def __call__(self, **kwargs):
>       return self._docall(self.methods, kwargs)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:521: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <HookCaller 'pytest_runtest_teardown'>
methods = [<function pytest_runtest_teardown at 0x12c3578>, <function pytest_runtest_teardown at 0x13e6500>, <bound method CaptureManager.pytest_runtest_teardown of <_pytest.capture.CaptureManager instance at 0x20d5440>>]
kwargs = {'__multicall__': <MultiCall 0 results, 0 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multi...lts, 0 meths, kwargs={...}>, 'nextitem': None}>, 'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, 'nextitem': None}

    def _docall(self, methods, kwargs):
        return MultiCall(methods, kwargs,
>                        firstresult=self.firstresult).execute()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:528: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MultiCall 0 results, 0 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 0 meths, kwargs={...}>, 'nextitem': None}>

    def execute(self):
        all_kwargs = self.kwargs
        while self.methods:
            method = self.methods.pop()
            args = [all_kwargs[argname] for argname in varnames(method)]
            if hasattr(method, "hookwrapper"):
>               return wrapped_call(method(*args), self.execute)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:393: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

wrap_controller = <generator object pytest_runtest_teardown at 0x2223960>
func = <bound method MultiCall.execute of <MultiCall 0 results, 0 meths, kwargs={'ite...multicall__': <MultiCall 0 results, 0 meths, kwargs={...}>, 'nextitem': None}>>

    def wrapped_call(wrap_controller, func):
        """ Wrap calling to a function with a generator which needs to yield
        exactly once.  The yield point will trigger calling the wrapped function
        and return its CallOutcome to the yield point.  The generator then needs
        to finish (raise StopIteration) in order for the wrapped call to complete.
        """
        try:
            next(wrap_controller)   # first yield
        except StopIteration:
            raise_wrapfail(wrap_controller, "did not yield")
        call_outcome = CallOutcome(func)
        try:
            wrap_controller.send(call_outcome)
            raise_wrapfail(wrap_controller, "has second yield")
        except StopIteration:
            pass
>       return call_outcome.get_result()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:113: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.core.CallOutcome instance at 0x2152a28>

    def get_result(self):
        if self.excinfo is None:
            return self.result
        else:
            ex = self.excinfo
            if py3:
                raise ex[1].with_traceback(ex[2])
>           py.builtin._reraise(*ex)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.core.CallOutcome instance at 0x2152a28>, func = <bound method MultiCall.execute of <MultiCall 0 results, 0 meths, kwargs={'ite...multicall__': <MultiCall 0 results, 0 meths, kwargs={...}>, 'nextitem': None}>>

    def __init__(self, func):
        try:
>           self.result = func()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:123: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MultiCall 0 results, 0 meths, kwargs={'item': <IPyNbCell 'tests/test_series_plots.ipynb'>, '__multicall__': <MultiCall 0 results, 0 meths, kwargs={...}>, 'nextitem': None}>

    def execute(self):
        all_kwargs = self.kwargs
        while self.methods:
            method = self.methods.pop()
            args = [all_kwargs[argname] for argname in varnames(method)]
            if hasattr(method, "hookwrapper"):
                return wrapped_call(method(*args), self.execute)
>           res = method(*args)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/core.py:394: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <IPyNbCell 'tests/test_series_plots.ipynb'>, nextitem = None

    def pytest_runtest_teardown(item, nextitem):
>       item.session._setupstate.teardown_exact(item, nextitem)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>, item = <IPyNbCell 'tests/test_series_plots.ipynb'>, nextitem = None

    def teardown_exact(self, item, nextitem):
        needed_collectors = nextitem and nextitem.listchain() or []
>       self._teardown_towards(needed_collectors)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:382: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>, needed_collectors = []

    def _teardown_towards(self, needed_collectors):
        while self.stack:
            if self.stack == needed_collectors[:len(self.stack)]:
                break
>           self._pop_and_teardown()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:388: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>

    def _pop_and_teardown(self):
        colitem = self.stack.pop()
>       self._teardown_with_finalization(colitem)

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:348: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.runner.SetupState object at 0x215df50>, colitem = <IPyNbFile 'tests/test_series_plots.ipynb'>

    def _teardown_with_finalization(self, colitem):
        self._callfinalizers(colitem)
        if hasattr(colitem, "teardown"):
>           colitem.teardown()

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/_pytest/runner.py:368: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <IPyNbFile 'tests/test_series_plots.ipynb'>

    def teardown(self):
>       self.kernel.stop()
E       AttributeError: 'IPyNbFile' object has no attribute 'kernel'

../../../.virtualenvs/nvd3/local/lib/python2.7/site-packages/pytest_ipynb/plugin.py:82: AttributeError
========================================================================================================= 6 error in 0.45 seconds =========================================================================================================
zonca commented

confirmed. all API changed.

my plan is to rewrite the plugin using runipy in programmatic mode:

https://github.com/paulgb/runipy#programmatic-use

this way I should be able to support all versions of IPython.

zonca commented

Rewrote the plugin with runipy, a lot cleaner,
can you please test if this works?

oz123 commented

Hi !
Thank you so much for fixing this. I tested the new code, and it works nicely. Cells with passing tests pass and those who should fail, fail

05/17/2015 08:18:57 AM INFO: Cell returned
05/17/2015 08:18:57 AM INFO: Running cell:
"""test_irregular_datetime"""
rng = date_range('1/1/2000', '3/1/2000')
rng = rng[[0, 1, 2, 3, 5, 9, 10, 11, 12]]
ser = Series(randn(len(rng)), rng)
ax = ser.plot()
xp = datetime(1999, 1, 1).toordinal()
ax.set_xlim('1/1/1999', '1/1/2001')
assert xp == ax.get_xlim()[0]

05/17/2015 08:18:58 AM INFO: Cell returned
05/17/2015 08:18:58 AM INFO: Running cell:
"""failing test"""
1/0
a = 3

05/17/2015 08:18:58 AM INFO: Cell raised uncaught exception: 
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-5-28a46494385d> in <module>()
      1 """failing test"""
----> 2 1/0
      3 a = 3

ZeroDivisionError: integer division or modulo by zero
05/17/2015 08:18:58 AM INFO: Shutdown kernel
05/17/2015 08:18:59 AM WARNING: Exiting with nonzero exit status
oz123 commented

I must reopen this is issue. On a new OS (gentoo) I can't find the correct combination of parts to get this working. I am working with the following virtual environment:

$ pip freeze
You are using pip version 6.0.6, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
cov-core==1.15.0
coverage==3.7.1
functools32==3.2.3.post1
ipython==3.2.0
Jinja2==2.7.3
jsonschema==2.5.1
MarkupSafe==0.23
py==1.4.29
pytest==2.7.2
pytest-cov==1.8.1
pytest-ipynb==1.0
python-nvd3==0.13.8
python-slugify==0.1.0
pyzmq==13.0.0
Unidecode==0.4.18

And I am seeing the following error:

../../.virtualenvs/test2/lib/python2.7/site-packages/_pytest/runner.py:368: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <IPyNbFile 'tests/test_series_plots.ipynb'>

    def teardown(self):
>       self.kernel.stop()
E       AttributeError: 'IPyNbFile' object has no attribute 'kernel'

zonca commented

there is something wrong, in pip freeze you don't have runipy.
the 1.0 version of pytest-ipynb needs runipy

zonca commented

tested with this conda env and the test case worked:

(testpytestipynb) zonca@nebula ~/p/s/pytest-ipynb (master)> pip freeze
certifi==14.5.14
ipython==3.2.0
Jinja2==2.7.3
jsonschema==2.4.0
MarkupSafe==0.23
matplotlib==1.4.3
mistune==0.6
nose==1.3.7
numpy==1.9.2
pandas==0.16.2
ptyprocess==0.4
py==1.4.30
Pygments==2.0.2
pyparsing==2.0.3
pytest==2.7.2
pytest-ipynb==1.0
python-dateutil==2.4.2
pytz==2015.4
pyzmq==14.7.0
runipy==0.1.3
six==1.9.0
terminado==0.5
tornado==4.2

pip does not install the latest commit, but probably commit 29ad58a.
The runipy rewrite was later.

Installing as pip install git+https://github.com/zonca/pytest-ipynb fixes this issue.

zonca commented

thanks @psomhorst , updated the package on pypi

oz123 commented

@zonca thanks for keeping up with this.

Here is what the situation looks like now on my system, and everything works properly with ipython 3.

coverage==3.7.1
decorator==4.0.2
functools32==3.2.3.post2
ipython==3.0.0
ipython-genutils==0.1.0
Jinja2==2.8
jsonschema==2.5.1
MarkupSafe==0.23
path.py==7.7.1
pexpect==3.3
pickleshare==0.5
py==1.4.30
Pygments==2.0.2
pytest==2.7.2
pytest-cov==2.1.0
pytest-ipynb==1.0.1
python-slugify==0.0.9
pyzmq==14.7.0
runipy==0.1.3
simplegeneric==0.8.1
traitlets==4.0.0
Unidecode==0.4.18

It seems that IPython devs keep breaking things up ... Currently this works, but it does not work with IPython 4.
Never the less I am closing this ticket, as the title says it is broken with IPython 3, and this is now fixed.