Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ image: Visual Studio 2019
# environment variables
environment:
matrix:
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"
- PYTHON: "C:\\Python38-x64"
- PYTHON: "C:\\Python39-x64"
Expand Down
1 change: 1 addition & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dependencies:
- matplotlib
- sphinx
- nbsphinx>=0.3.1
- sphinx-rtd-theme
23 changes: 6 additions & 17 deletions nbval/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,14 @@ def pytest_configure(config):



def pytest_collect_file(path, parent):
def pytest_collect_file(file_path, parent):
"""
Collect IPython notebooks using the specified pytest hook
"""
opt = parent.config.option
if (opt.nbval or opt.nbval_lax) and path.fnmatch("*.ipynb"):
if (opt.nbval or opt.nbval_lax) and file_path.suffix == ".ipynb":
# https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent
if hasattr(IPyNbFile, "from_parent"):
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)

return IPyNbFile.from_parent(parent, path=file_path)


comment_markers = {
Expand Down Expand Up @@ -351,13 +344,9 @@ def collect(self):
options.update(comment_opts)
options.setdefault('check', self.compare_outputs)
name = 'Cell ' + str(cell_num)
# 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
)
else:
yield IPyNbCell(name, self, cell_num, cell, options)
yield IPyNbCell.from_parent(
self, name=name, cell_num=cell_num, cell=cell, options=options
)

# Update 'code' cell count
cell_num += 1
Expand Down
18 changes: 13 additions & 5 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
type: sphinx
python:
version: 3.8
pip_install: true
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "mambaforge-latest"

conda:
file: docs/environment.yml
environment: docs/environment.yml

python:
install:
- method: pip
path: .
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
]
},
install_requires = [
'pytest >= 2.8',
'pytest >= 7',
'jupyter_client',
'nbformat',
'ipykernel',
'coverage',
],
python_requires='>=3.6, <4',
python_requires='>=3.7, <4',
classifiers = [
'Framework :: IPython',
'Framework :: Pytest',
Expand Down