From 8cfa66bef380bf6d54479a06b092da30dbc9a7c4 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 10 Feb 2022 17:57:12 +0100 Subject: [PATCH] Tests should work in the absence of a kernel (#921) --- .github/workflows/continuous-integration.yml | 24 ++++++++++++++++++++ codecov.yml | 2 +- docs/CHANGELOG.md | 9 +++++++- jupytext/version.py | 2 +- tests/test_contentsmanager.py | 2 ++ tests/test_execute.py | 2 ++ tests/test_using_cli.py | 3 ++- 7 files changed, 40 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index abc7daf3d..8f62a555c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -195,6 +195,30 @@ jobs: - name: Upload coverage uses: codecov/codecov-action@v1 + test-pip-no-kernel: + needs: skip_duplicate + if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} + strategy: + matrix: + python-version: [ 3.7 ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements-dev.txt + - name: Test with pytest + run: pytest --cov=./ --cov-report=xml + - name: Upload coverage + uses: codecov/codecov-action@v1 + build: name: Build runs-on: ubuntu-latest diff --git a/codecov.yml b/codecov.yml index be70b0717..a7f8ca381 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,5 +1,5 @@ comment: - after_n_builds: 8 + after_n_builds: 9 coverage: status: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0fbfc9402..3737ec62b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,11 +1,18 @@ Jupytext ChangeLog ================== +1.13.8 (2022-02-??) +------------------- + +**Fixed** +- We made sure that our tests also work in absence of a Python kernel ([#906](https://github.com/mwouts/jupytext/issues/906)) + + 1.13.7 (2022-02-09) ------------------- **Fixed** -- The Jupytext CLI only suggest --update when the target is an .ipynb file ([#905](https://github.com/mwouts/jupytext/issues/905)) - thanks to [st--](https://github.com/st--) for this contribution +- The Jupytext CLI only suggest `--update` when the target is an .ipynb file ([#905](https://github.com/mwouts/jupytext/issues/905)) - thanks to [st--](https://github.com/st--) for this contribution - We made sure that commands like `cat notebook.md | jupytext --execute` work ([#908](https://github.com/mwouts/jupytext/issues/908)) **Added** diff --git a/jupytext/version.py b/jupytext/version.py index 3c3f9d26b..80b120dd5 100644 --- a/jupytext/version.py +++ b/jupytext/version.py @@ -1,3 +1,3 @@ """Jupytext's version number""" -__version__ = "1.13.7" +__version__ = "1.13.8-dev" diff --git a/tests/test_contentsmanager.py b/tests/test_contentsmanager.py index 196e4599e..d324f73e1 100644 --- a/tests/test_contentsmanager.py +++ b/tests/test_contentsmanager.py @@ -23,6 +23,7 @@ requires_pandoc, requires_quarto, requires_sphinx_gallery, + requires_user_kernel_python3, ) @@ -1215,6 +1216,7 @@ def test_global_pairing_allows_to_save_other_file_types(nb_file, tmpdir): compare_notebooks(nb2, nb) +@requires_user_kernel_python3 @pytest.mark.parametrize("nb_file", list_notebooks("R")) def test_python_kernel_preserves_R_files(nb_file, tmpdir): """Opening a R file with a Jupyter server that has no R kernel should not modify the file""" diff --git a/tests/test_execute.py b/tests/test_execute.py index cd64ad45d..b1c65fb53 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -263,6 +263,7 @@ def sample_md_notebook(): """ +@requires_user_kernel_python3 def test_execute_text_file_does_update_the_metadata(sample_md_notebook, tmp_path): md_file = tmp_path / "nb.md" md_file.write_text(sample_md_notebook) @@ -274,6 +275,7 @@ def test_execute_text_file_does_update_the_metadata(sample_md_notebook, tmp_path assert "kernelspec" in new_md_text +@requires_user_kernel_python3 def test_cat_execute_does_not_update_the_metadata(sample_md_notebook, tmp_path): md_file = tmp_path / "nb.md" md_file.write_text(sample_md_notebook) diff --git a/tests/test_using_cli.py b/tests/test_using_cli.py index c084f0e52..a0e54d86d 100644 --- a/tests/test_using_cli.py +++ b/tests/test_using_cli.py @@ -7,11 +7,12 @@ import jupytext from jupytext.cli import jupytext as jupytext_cli -from .utils import requires_black, requires_myst +from .utils import requires_black, requires_myst, requires_user_kernel_python3 doc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "docs") +@requires_user_kernel_python3 @requires_black @requires_myst @pytest.mark.skipif(