From fd832f4055e61d231c6532ed8e66cbd449a99195 Mon Sep 17 00:00:00 2001 From: alex-treebeard Date: Wed, 5 Jun 2024 15:51:39 +0000 Subject: [PATCH 1/5] pre-commit and actions msg --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- src/nbmake/pytest_plugin.py | 15 ++++++++++++++- tests/resources/a_test.py | 3 +-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e6d6a5e..df4ee74 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,7 @@ assignees: '' --- -> [!Note] +> [!Note] > It may be quicker to check in with us on [Discord](https://discord.gg/QFjCpMjqRY) before logging your issue diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3aedd9a..7b964b0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,7 +7,7 @@ assignees: '' --- -> [!Note] +> [!Note] > It may be quicker to check in with us on [Discord](https://discord.gg/QFjCpMjqRY) before logging your issue **Is your feature request related to a problem? Please describe.** diff --git a/src/nbmake/pytest_plugin.py b/src/nbmake/pytest_plugin.py index 5e77e85..3c95204 100644 --- a/src/nbmake/pytest_plugin.py +++ b/src/nbmake/pytest_plugin.py @@ -5,6 +5,8 @@ from pathlib import Path from typing import Any, Optional +from pytest import ExitCode + from .pytest_items import NotebookFile @@ -73,4 +75,15 @@ def pytest_terminal_summary(terminalreporter: Any, exitstatus: int, config: Any) # this message can be disabled with pytest --no-summary # but let us know if it is annoying you # ...we can also print diagnostics/stats here -- requests welcome - print(f"\nLearn more about nbmake at https://github.com/treebeardtech/nbmake\n") + try: + if os.environ.get("GITHUB_ACTIONS", False): + if exitstatus == ExitCode.TESTS_FAILED: + print( + f"\n* Automate reading GitHub Actions logs with our bot: https://github.com/marketplace/treebeard-build\n" + ) + else: + print( + f"\nLearn more about nbmake at https://github.com/treebeardtech/nbmake\n" + ) + except: + pass diff --git a/tests/resources/a_test.py b/tests/resources/a_test.py index 4c55958..a0ff4ca 100644 --- a/tests/resources/a_test.py +++ b/tests/resources/a_test.py @@ -1,3 +1,2 @@ - def test_x(): - assert True \ No newline at end of file + assert True From 2be8e20e959658122f128b35eff8cd5f6e8f08cf Mon Sep 17 00:00:00 2001 From: alex-treebeard Date: Wed, 5 Jun 2024 16:55:13 +0000 Subject: [PATCH 2/5] upgrade poetry --- .devcontainer/Dockerfile | 2 +- .devcontainer/vm/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 39dbbd8..5bc78a2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,6 +6,6 @@ ARG NODE_VERSION="lts/*" RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi USER vscode RUN pip3 --disable-pip-version-check --no-cache-dir install -U \ - 'poetry==1.1.13' \ + 'poetry==1.8.3' \ 'pip==22.1.2' RUN npm install -g @devcontainers/cli@v0.30.0 \ No newline at end of file diff --git a/.devcontainer/vm/Dockerfile b/.devcontainer/vm/Dockerfile index 39dbbd8..5bc78a2 100644 --- a/.devcontainer/vm/Dockerfile +++ b/.devcontainer/vm/Dockerfile @@ -6,6 +6,6 @@ ARG NODE_VERSION="lts/*" RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi USER vscode RUN pip3 --disable-pip-version-check --no-cache-dir install -U \ - 'poetry==1.1.13' \ + 'poetry==1.8.3' \ 'pip==22.1.2' RUN npm install -g @devcontainers/cli@v0.30.0 \ No newline at end of file From 6884438a5213dd5672017cf15dc8aa838ff4746c Mon Sep 17 00:00:00 2001 From: alex-treebeard Date: Wed, 5 Jun 2024 17:27:53 +0000 Subject: [PATCH 3/5] t --- .github/workflows/pytest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b1ed55d..3098f79 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,6 +36,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install poetry - run: poetry install + - run: pytest --nbmake tests/resources/magic_error.ipynb - run: poetry run pytest --cov-report=xml --cov=src - uses: codecov/codecov-action@v1 with: From e1b85fa905ca61bc9874bd4faefb8f5dad03e9cc Mon Sep 17 00:00:00 2001 From: alex-treebeard Date: Wed, 5 Jun 2024 17:29:10 +0000 Subject: [PATCH 4/5] . --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 3098f79..b9483c0 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,7 +36,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install poetry - run: poetry install - - run: pytest --nbmake tests/resources/magic_error.ipynb + - run: poetry run pytest --nbmake tests/resources/magic_error.ipynb - run: poetry run pytest --cov-report=xml --cov=src - uses: codecov/codecov-action@v1 with: From 027c350d389db4dac7114fd2f2db0120fa37dd73 Mon Sep 17 00:00:00 2001 From: alex-treebeard Date: Wed, 5 Jun 2024 17:39:10 +0000 Subject: [PATCH 5/5] t --- .github/workflows/pytest.yml | 1 - src/nbmake/pytest_plugin.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b9483c0..b1ed55d 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,7 +36,6 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install poetry - run: poetry install - - run: poetry run pytest --nbmake tests/resources/magic_error.ipynb - run: poetry run pytest --cov-report=xml --cov=src - uses: codecov/codecov-action@v1 with: diff --git a/src/nbmake/pytest_plugin.py b/src/nbmake/pytest_plugin.py index 3c95204..ae2f2ac 100644 --- a/src/nbmake/pytest_plugin.py +++ b/src/nbmake/pytest_plugin.py @@ -79,7 +79,7 @@ def pytest_terminal_summary(terminalreporter: Any, exitstatus: int, config: Any) if os.environ.get("GITHUB_ACTIONS", False): if exitstatus == ExitCode.TESTS_FAILED: print( - f"\n* Automate reading GitHub Actions logs with our bot: https://github.com/marketplace/treebeard-build\n" + f"\n* nbmake: Automate reading GitHub Actions logs with our bot: https://github.com/marketplace/treebeard-build\n" ) else: print(