From 08163eb46947452323a0c0910cb596efa2b489bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Bre=C3=9Fler?= Date: Tue, 7 May 2024 17:13:48 +0200 Subject: [PATCH 1/4] Allow GH action to be triggered manually --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f2a5f03..3524778 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,8 @@ on: - 'v*' pull_request: + workflow_dispatch: + jobs: pre-commit: From 961270a81b1c7aabf073b9ffd904ef8ecf43ba07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Bre=C3=9Fler?= Date: Tue, 7 May 2024 18:17:20 +0200 Subject: [PATCH 2/4] work around PermissionErrors in /tmp dirs by test_run_fail() test --- tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tox.ini b/tox.ini index c1c9160..66a7458 100644 --- a/tox.ini +++ b/tox.ini @@ -36,3 +36,6 @@ nb_diff_replace = /cells/*/outputs/*/text plugins\:\s.*\n "plugin info ...\n" /cells/*/outputs/*/text "exec_cwd\=\\\'\/([A-z0-9-_+]+\/)*[A-z0-9-_+]+\\\'" "exec_cwd=/.../" /cells/*/outputs/*/traceback \ "" + +# work around PermissionErrors in /tmp dirs by test_run_fail() test +addopts = --basetemp=tmp From f5b47839b638acaa1d68bfaac5458328b82ee8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Bre=C3=9Fler?= Date: Tue, 7 May 2024 18:25:56 +0200 Subject: [PATCH 3/4] tests: add the expected diff_replace loaded from pytest config in tox.ini --- tests/test_plugin_fixture.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/test_plugin_fixture.py b/tests/test_plugin_fixture.py index c98c927..5648064 100644 --- a/tests/test_plugin_fixture.py +++ b/tests/test_plugin_fixture.py @@ -67,6 +67,44 @@ def test_nb(nb_regression): # the following are the defaults for pytest-cov "cov_source": (), "cov_config": ".coveragerc", + # expected diff_replace loaded from pytest config in tox.ini + "diff_replace": ( + ( + "/cells/*/outputs/*/text", + "\\/([A-z0-9-_+]+\\/)*[A-z0-9-_+]+\\.ipynb", + "/.../.ipynb", + ), + ( + "/cells/*/outputs/*/text", + "rootdir\\:\\s\\/([A-z0-9-_+]+\\/)*[A-z0-9-_+]+", + "rootdir: /.../", + ), + ( + "/cells/*/outputs/*/text", + "in\\s[\\.0-9]+\\sseconds", + "in xxx seconds", + ), + ( + "/cells/*/outputs/*/text", + "platform\\s(darwin|linux).*\\n", + "platform info ...\\n", + ), + ( + "/cells/*/outputs/*/text", + "plugins\\:\\s.*\\n", + "plugin info ...\\n", + ), + ( + "/cells/*/outputs/*/text", + "exec_cwd\\=\\\\\\'\\/([A-z0-9-_+]+\\/)*[A-z0-9-_+]+\\\\\\'", + "exec_cwd=/.../", + ), + ( + "/cells/*/outputs/*/traceback", + "\\", + "", + ), + ), } ) ) From b70c4406ea6d571d0681889292cb4036cf9026ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Bre=C3=9Fler?= Date: Tue, 7 May 2024 18:51:46 +0200 Subject: [PATCH 4/4] fix PytestRemovedIn9Warning - already reported and same patch as in #74 --- pytest_notebook/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest_notebook/plugin.py b/pytest_notebook/plugin.py index ab9cd3e..0c85142 100644 --- a/pytest_notebook/plugin.py +++ b/pytest_notebook/plugin.py @@ -11,6 +11,7 @@ """ import os +from pathlib import Path import shlex import pytest @@ -270,7 +271,7 @@ def pytest_collect_file(path, parent): path.fnmatch(pat) for pat in other_args.get("nb_file_fnmatch", ["*.ipynb"]) ): try: - return JupyterNbCollector.from_parent(parent, fspath=path) + return JupyterNbCollector.from_parent(parent, path=Path(path)) except AttributeError: return JupyterNbCollector(path, parent)