Skip to content

Commit

Permalink
Merge pull request #191 from pgbarletta/fix-warn
Browse files Browse the repository at this point in the history
Fixed PytestRemovedIn8Warning.
  • Loading branch information
minrk committed Jan 10, 2023
2 parents f48c660 + 3f9dd52 commit 184d364
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nbval/plugin.py
Expand Up @@ -15,6 +15,7 @@
import hashlib
import warnings
from collections import OrderedDict, defaultdict
from pathlib import Path

from queue import Empty

Expand Down Expand Up @@ -141,7 +142,10 @@ def pytest_collect_file(path, parent):
if (opt.nbval or opt.nbval_lax) and path.fnmatch("*.ipynb"):
# https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent
if hasattr(IPyNbFile, "from_parent"):
return IPyNbFile.from_parent(parent, fspath=path)
try: # Pytest >= 7.0.0
return IPyNbFile.from_parent(parent, path=Path(path))
except AssertionError:
return IPyNbFile.from_parent(parent, fspath=path)
else: # Pytest < 5.4
return IPyNbFile(path, parent)

Expand Down

0 comments on commit 184d364

Please sign in to comment.