From aca80b7b5c813b56f2d05f591151b65786fbb88a Mon Sep 17 00:00:00 2001 From: Andrii Ieroshenko Date: Mon, 18 Dec 2023 11:00:50 -0800 Subject: [PATCH] Run unit tests as a part of CI (#519) * Add ci step to run unit tests * Skip test_forbid_write_write_conflict as flakey * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Comments per @dlqqq --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/unit-tests.yml | 30 +++++++++++++++++++ .../jupyter_ai/tests/test_config_manager.py | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..4feb77be9 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,30 @@ +name: Python Unit Tests + +# suppress warning raised by https://github.com/jupyter/jupyter_core/pull/292 +env: + JUPYTER_PLATFORM_DIRS: "1" + +on: + push: + branches: main + pull_request: + branches: "*" + +jobs: + unit-tests: + name: Linux + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + + - name: Install extension dependencies and build the extension + run: ./scripts/install.sh + + - name: Execute unit tests + run: | + set -eux + pytest -vv -r ap --cov jupyter_ai diff --git a/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py b/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py index dca79393a..126bd8f49 100644 --- a/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py +++ b/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py @@ -269,6 +269,8 @@ def test_update_after_describe(cm: ConfigManager): assert new_config.model_provider_id == "cohere:medium" +# TODO: make the test work on Linux including CI. +@pytest.mark.skip(reason="Flakey on Linux including CI.") def test_forbid_write_write_conflict(cm: ConfigManager): configure_to_openai(cm) # call DescribeConfig