Skip to content

Commit

Permalink
Fixed PytestRemovedIn8Warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
pgbarletta committed Oct 24, 2022
1 parent f48c660 commit 3f9dd52
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nbval/plugin.py
Original file line number Diff line number Diff line change
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 3f9dd52

Please sign in to comment.