-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprication warnings from Pytest #139
Comments
PRs are always welcome :) |
I have the exact same behaviour with |
Has anyone had a crack at this yet? It is now an error, rather than a warning: ============================= test session starts ==============================
platform linux -- Python 3.7.8, pytest-6.0.0, py-1.9.0, pluggy-0.13.1
rootdir: /root/***
plugins: cov-2.10.0, nbval-0.9.5
collected 0 items / 1 error ==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.7/site-packages/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.7/site-packages/nbval/plugin.py:115: in pytest_collect_file
return IPyNbFile(path, parent)
../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.7/site-packages/_pytest/nodes.py:95: in __call__
warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2)
E pytest.PytestDeprecationWarning: Direct construction of IPyNbFile has been deprecated, please use IPyNbFile.from_parent.
E See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details. |
Fixes compatibility with pytest >=6. Closes computationalmodellinggh-139
…compatible with latest pytest 6.0.0 See computationalmodelling/nbval#139 Error from Finch Travis-CI build https://travis-ci.org/github/bird-house/finch/jobs/713031486 $ make test-notebooks Copying notebook output sanitizer ... Running notebook-based tests ============================= test session starts ============================== platform linux -- Python 3.7.8, pytest-6.0.0, py-1.9.0, pluggy-0.13.1 -- /home/travis/miniconda/envs/finch/bin/python cachedir: .pytest_cache rootdir: /home/travis/build/bird-house/finch, configfile: setup.cfg plugins: nbval-0.9.5, notebook-0.6.0, flake8-1.0.6 collected 0 items / 1 error ==================================== ERRORS ==================================== ________________________ ERROR collecting test session _________________________ Traceback (most recent call last): File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall return outcome.get_result() File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/nbval/plugin.py", line 115, in pytest_collect_file return IPyNbFile(path, parent) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/_pytest/nodes.py", line 95, in __call__ warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2) pytest.PytestDeprecationWarning: Direct construction of IPyNbFile has been deprecated, please use IPyNbFile.from_parent. See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details. =========================== short test summary info ============================ ERROR - pytest.PytestDeprecationWarning: Direct construction of IPyNbFile ha... !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! =============================== 1 error in 0.14s =============================== Makefile:128: recipe for target 'test-notebooks' failed make: *** [test-notebooks] Error 2
Thanks for fixing. |
@omry - Vidar already did, version 0.9.6. |
tl;dr The 3rd DeprecationWarning listed in the original issue is still happening. It's due to jupyter_client. They've fixed the issue, but haven't done a new release yet. The DeprecationWarning isn't causing a failure for me, even on pytest-6.1.2. With a minimal Python 3 notebook (just 1 code cell: % pytest --nbval nbval_deprecation_test.ipynb
===================================== test session starts ======================================
platform darwin -- Python 3.9.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: .../my-repo, configfile: pytest.ini
plugins: nbval-0.9.6, cov-2.10.1
collected 1 item
nbval_deprecation_test.ipynb . [100%]
======================================= warnings summary =======================================
.../nbval_deprecation_test.ipynb::Cell 0
.../lib/python3.9/site-packages/jupyter_client/manager.py:66: DeprecationWarning: KernelManager._kernel_spec_manager_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
def _kernel_spec_manager_changed(self):
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================= 1 passed, 1 warning in 1.28s ================================= It seems like this is a jupyter_client issue, fixed on 2020-11-11: jupyter/jupyter_client#588 There hasn't been a jupyter_client release that includes the fix, though. |
…compatible with latest pytest 6.0.0 See computationalmodelling/nbval#139 Error from Finch Travis-CI build https://travis-ci.org/github/bird-house/finch/jobs/713031486 $ make test-notebooks Copying notebook output sanitizer ... Running notebook-based tests ============================= test session starts ============================== platform linux -- Python 3.7.8, pytest-6.0.0, py-1.9.0, pluggy-0.13.1 -- /home/travis/miniconda/envs/finch/bin/python cachedir: .pytest_cache rootdir: /home/travis/build/bird-house/finch, configfile: setup.cfg plugins: nbval-0.9.5, notebook-0.6.0, flake8-1.0.6 collected 0 items / 1 error ==================================== ERRORS ==================================== ________________________ ERROR collecting test session _________________________ Traceback (most recent call last): File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall return outcome.get_result() File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/nbval/plugin.py", line 115, in pytest_collect_file return IPyNbFile(path, parent) File "/home/travis/miniconda/envs/finch/lib/python3.7/site-packages/_pytest/nodes.py", line 95, in __call__ warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2) pytest.PytestDeprecationWarning: Direct construction of IPyNbFile has been deprecated, please use IPyNbFile.from_parent. See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details. =========================== short test summary info ============================ ERROR - pytest.PytestDeprecationWarning: Direct construction of IPyNbFile ha... !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! =============================== 1 error in 0.14s =============================== Makefile:128: recipe for target 'test-notebooks' failed make: *** [test-notebooks] Error 2
Problem Description
I run some tests using nbval that raised the following warnings:
cell, options)
def _kernel_spec_manager_changed(self):
Environment Details:
I can probably create a PR to fix these issues if you want.
The text was updated successfully, but these errors were encountered: