From d17950cdc3b872f25e5eb78072b748fd1c1ed907 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 14 Mar 2023 01:37:34 +0100 Subject: [PATCH 1/2] fix: pass `fspath` to `from_parent` --- nbval/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbval/plugin.py b/nbval/plugin.py index 7e75a5d..7c23d85 100644 --- a/nbval/plugin.py +++ b/nbval/plugin.py @@ -354,7 +354,7 @@ def collect(self): # https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent if hasattr(IPyNbCell, "from_parent"): yield IPyNbCell.from_parent( - self, name=name, cell_num=cell_num, cell=cell, options=options + self, fspath=self.fspath, name=name, cell_num=cell_num, cell=cell, options=options ) else: yield IPyNbCell(name, self, cell_num, cell, options) From b93516e598c2e14d27c868c3c7dbdc3b5b14053f Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 14 Mar 2023 01:55:04 +0100 Subject: [PATCH 2/2] extend except --- nbval/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbval/plugin.py b/nbval/plugin.py index 7c23d85..e9da228 100644 --- a/nbval/plugin.py +++ b/nbval/plugin.py @@ -144,7 +144,7 @@ def pytest_collect_file(path, parent): if hasattr(IPyNbFile, "from_parent"): try: # Pytest >= 7.0.0 return IPyNbFile.from_parent(parent, path=Path(path)) - except AssertionError: + except (AssertionError, TypeError): return IPyNbFile.from_parent(parent, fspath=path) else: # Pytest < 5.4 return IPyNbFile(path, parent) @@ -354,7 +354,7 @@ def collect(self): # https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent if hasattr(IPyNbCell, "from_parent"): yield IPyNbCell.from_parent( - self, fspath=self.fspath, name=name, cell_num=cell_num, cell=cell, options=options + self, name=name, cell_num=cell_num, cell=cell, options=options ) else: yield IPyNbCell(name, self, cell_num, cell, options)