nbval icon indicating copy to clipboard operation
nbval copied to clipboard

'IPyNbCell' object has no attribute 'funcargs'

Open ElephantsDad opened this issue 5 years ago • 3 comments

I'm trying to find the way to test all of my jupyterlab extensions in one notebook and I found that nbval could be usefull. But I can't even use it properly, because I'm having this error almost in every notebook (it occures even in documentation index.ipynb file from docs/source).

UPD: I forgot to tell that it happens in jupyterlab in docker container, seems like error doesn't show up outside it For example: Code in cell (I know this test should be failed because of random):

import numpy as np
print([np.random.rand() for i in range(4)])
print([np.random.rand() for i in range(4)])

Executing with: py.test --nbval Untitled.ipynb

And got internal error:

Full error
platform linux -- Python 3.6.9, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
plugins: nbval-0.9.6, dash-1.1.1
collected 2 items                                                                                                                                                                                  

Untitled.ipynb 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/main.py", line 296, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/runner.py", line 100, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/runner.py", line 117, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/_pytest/runner.py", line 209, in call_and_report
INTERNALERROR>     report = hook.pytest_runtest_makereport(item=item, call=call)  # type: TestReport
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/usr/local/lib/python3.6/dist-packages/dash/testing/plugin.py", line 65, in pytest_runtest_makereport
INTERNALERROR>     for name, fixture in item.funcargs.items():
INTERNALERROR> AttributeError: 'IPyNbCell' object has no attribute 'funcargs'

ElephantsDad avatar Aug 06 '20 02:08 ElephantsDad

I see you have a brand new version of pytest there (6.0.1). There might be some issues with that. Thanks for reporting!

vidartf avatar Aug 11 '20 10:08 vidartf

I see you have a brand new version of pytest there (6.0.1). There might be some issues with that. Thanks for reporting!

Oh, I didn't think about that. Can you please tell me, what version of pytest is compatible with current nbval version?

ElephantsDad avatar Aug 17 '20 03:08 ElephantsDad

I suspect from the traceback that the pytest version is a red herring. I think nbval is clashing with another pytest plugin you have installed - dash/testing/plugin.py .

takluyver avatar Aug 17 '20 09:08 takluyver