nbval icon indicating copy to clipboard operation
nbval copied to clipboard

new pytest version throws deprecation warning

Open Jasha10 opened this issue 3 years ago • 0 comments

Earlier today, pytest v7.0.0 was released. With this new pytest version installed, running pytest --nbval my_notebook.ipynb throws a deprecation warning:

E   pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to IPyNbFile is deprecated. Please use the (path: pathlib.Path) argument instead.
E   See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path

Here is the full traceback for the warning:

.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/nbval/plugin.py:117: in pytest_collect_file
    return IPyNbFile.from_parent(parent, fspath=path)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/_pytest/nodes.py:633: in from_parent
    return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/_pytest/nodes.py:264: in from_parent
    return cls._create(parent=parent, **kw)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/_pytest/nodes.py:140: in _create
    return super().__call__(*k, **kw)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/nbval/plugin.py:206: in __init__
    super(IPyNbFile, self).__init__(*args, **kwargs)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/_pytest/nodes.py:588: in __init__
    path = _imply_path(type(self), path, fspath=fspath)
.nox/test_jupyter_notebooks-3-9/lib/python3.9/site-packages/_pytest/nodes.py:110: in _imply_path
    warnings.warn(
E   pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to IPyNbFile is deprecated. Please use the (path: pathlib.Path) argument instead.
E   See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path

Jasha10 avatar Feb 04 '22 20:02 Jasha10