Skip to content

Commit

Permalink
fix pytest>=7.0.0 error
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 27, 2022
1 parent 6dd2eaa commit 9690f8e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nbval/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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)
except Exception:
return IPyNbFile.from_parent(parent, fspath=path)
else: # Pytest < 5.4
return IPyNbFile(path, parent)

Expand Down

0 comments on commit 9690f8e

Please sign in to comment.