diff --git a/docs/source/conf.py b/docs/source/conf.py index 31bd775..d1ea4b7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -84,11 +84,13 @@ nitpick_ignore = [ ("py:class", "NoneType"), + ("py:class", "TextIO"), ("py:class", "attr.ib"), ("py:class", "attr.s"), ("py:class", "ruamel.yaml.dumper.RoundTripDumper"), ("py:exc", "nbconvert.preprocessors.CellExecutionError"), ("py:class", "nbdime.diff_format.DiffEntry"), + ("py:class", "_pytest.nodes.Item"), ] # The reST default role (used for this markup: `text`) to use for all diff --git a/pytest_notebook/execution.py b/pytest_notebook/execution.py index da243e3..8b13d6e 100644 --- a/pytest_notebook/execution.py +++ b/pytest_notebook/execution.py @@ -153,7 +153,7 @@ def preprocess(self, nb, resources, km=None): with self.setup_preprocessor(nb, resources, km=km): self.log.info(f"Executing notebook with kernel: {self.kernel_name}") if self.coverage and self.kernel_name.startswith("python"): - self.log.info(f"Recording coverage for notebook") + self.log.info("Recording coverage for notebook") self.coverage_setup(nb_version) try: nb, resources = super(ExecutePreprocessor, self).preprocess( diff --git a/pytest_notebook/nb_regression.py b/pytest_notebook/nb_regression.py index 918177d..1d7d056 100644 --- a/pytest_notebook/nb_regression.py +++ b/pytest_notebook/nb_regression.py @@ -300,7 +300,7 @@ def check( # TODO merge on fail option (using pytest-cov --no-cov-on-fail) if self.cov_merge and exec_results.has_coverage: - logger.info(f"Merging coverage.") + logger.info("Merging coverage.") self.cov_merge.data.update( exec_results.coverage_data(self.cov_merge.debug), aliases=_get_coverage_aliases(self.cov_merge), diff --git a/pytest_notebook/notebook.py b/pytest_notebook/notebook.py index af5df1f..5c0caeb 100644 --- a/pytest_notebook/notebook.py +++ b/pytest_notebook/notebook.py @@ -281,7 +281,7 @@ def create_notebook(as_version: int = DEFAULT_NB_VERSION): elif as_version == 3: notebook = nbformat.v3.new_notebook() elif as_version == 4: - notebook = nbformat.v4.new_notebook() + notebook = nbformat.v4.new_notebook(nbformat_minor=2) else: raise NotImplementedError(f"notebook version: {as_version}") return notebook diff --git a/pytest_notebook/plugin.py b/pytest_notebook/plugin.py index 7b3b158..59cd1cd 100644 --- a/pytest_notebook/plugin.py +++ b/pytest_notebook/plugin.py @@ -254,7 +254,7 @@ def pytest_collect_file(path, parent): if other_args.get("nb_test_files", False) and any( path.fnmatch(pat) for pat in other_args.get("nb_file_fnmatch", ["*.ipynb"]) ): - return JupyterNbCollector(path, parent) + return JupyterNbCollector.from_parent(parent, fspath=path) class JupyterNbCollector(pytest.File): @@ -266,7 +266,7 @@ class JupyterNbCollector(pytest.File): def collect(self): """Collect tests for the notebook.""" name = os.path.splitext(os.path.basename(self.fspath))[0] - yield JupyterNbTest(f"nbregression({name})", self) + yield JupyterNbTest.from_parent(self, name=f"nbregression({name})") class JupyterNbTest(pytest.Item): diff --git a/setup.py b/setup.py index f4a8ed5..d5894e7 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,9 @@ include_package_data=True, install_requires=[ "pytest>=3.5.0", - "attrs", + "attrs<21,>=19", "jupyter_client", - "nbconvert", + "nbconvert~=5.6.0", "nbdime", "nbformat", "jsonschema", @@ -33,7 +33,7 @@ ], extras_require={ "testing": [ - "coverage", + "coverage~=4.5.1", "pytest-cov", "pytest-regressions", "black==19.3b0", @@ -57,7 +57,7 @@ "ipypublish>=0.10.7", "ruamel.yaml", "ruamel.yaml.clib", - "coverage", + "coverage~=4.5.1", ], }, classifiers=[