Skip to content

Commit

Permalink
Update for newer pytest (#44)
Browse files Browse the repository at this point in the history
* Apply my suggestions from #43.
  • Loading branch information
ceball committed Sep 10, 2020
1 parent ba28c86 commit dbc4f53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions nbsmoke/__init__.py
Expand Up @@ -140,7 +140,10 @@ def __init__(self, fspath, parent=None, config=None, session=None, dowhat=RunNb)
super(IPyNbFile,self).__init__(fspath, parent=parent, config=None, session=None)

def collect(self):
yield self._dowhat(str(self.fspath), self)
if hasattr(self._dowhat, "from_parent"):
yield self._dowhat.from_parent(self,name=str(self.fspath))
else: # older pytest (https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent)
yield self._dowhat(str(self.fspath), self)


def pytest_collect_file(path, parent):
Expand All @@ -162,4 +165,7 @@ def pytest_collect_file(path, parent):
dowhat = LintNb
elif opt.nbsmoke_verify:
dowhat = VerifyNb
return IPyNbFile(path, parent, dowhat=dowhat)
if hasattr(IPyNbFile, "from_parent"):
return IPyNbFile.from_parent(parent, fspath=path, dowhat=dowhat)
else: # for older pytest (https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent)
return IPyNbFile(path, parent, dowhat=dowhat)
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -52,7 +52,7 @@ def read(fname):
# * Optional: process ipython magics (required import: IPython)
'jupyter_client',
'nbformat',
'nbconvert',
'nbconvert <6',
# TODO: I think the decision was to go with python/setup.py for this stuff,
# right? (but if so, how do I specify it's the runtime python version
# I'm talking aobut, not the buildtime python version?)
Expand Down

0 comments on commit dbc4f53

Please sign in to comment.