diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..c7cef8f --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,32 @@ +name: Pytest +on: pull_request +permissions: + contents: read + checks: write + pull-requests: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + Test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: "pip" + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install failure annotation plugin + run: pip install pytest-github-actions-annotate-failures + - name: Test with pytest + run: | + set -o pipefail + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov-report=html --cov | tee pytest-coverage.txt + - name: Comment pytest code coverage + uses: MishaKav/pytest-coverage-comment@main + if: ${{ always() }} + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 1f323b2..ebd4763 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -4,13 +4,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - ruff: + Check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: astral-sh/ruff-action@v3 with: args: check --output-format=github + Format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - uses: astral-sh/ruff-action@v3 with: - args: format --diff \ No newline at end of file + args: format --check --diff diff --git a/test/test_html.py b/test/test_html.py index 714bb34..0190342 100644 --- a/test/test_html.py +++ b/test/test_html.py @@ -1,5 +1,6 @@ import json +import pytest from bs4 import BeautifulSoup from jinja2 import Environment, FileSystemLoader from mistletoe import Document @@ -76,6 +77,8 @@ def include_stub(include): return includes.get(include) +@pytest.mark.skip("Requires special files") +@pytest.mark.html def test_html(capsys): with capsys.disabled(): with open("test/acceptanceTest.md") as file: diff --git a/test/test_html_slides.py b/test/test_html_slides.py index 291e528..adbba4a 100644 --- a/test/test_html_slides.py +++ b/test/test_html_slides.py @@ -1,6 +1,7 @@ import json import random +import pytest from jinja2 import Environment, FileSystemLoader from mistletoe import Document @@ -88,6 +89,8 @@ slide_template = env.get_template("slide/slide.html") questions = parse_katalog() +@pytest.mark.skip("Requires special files") +@pytest.mark.slide def test_html_slides(capsys): with capsys.disabled(): with open("test/acceptanceTestSlides.md") as file: diff --git a/test/test_question.py b/test/test_question.py index e4e4ceb..344692a 100644 --- a/test/test_question.py +++ b/test/test_question.py @@ -25,6 +25,7 @@ def test_question_html(): assert renderer.render(Document(assertion)) == assertions[assertion] +@pytest.mark.skip("Requires special files") @pytest.mark.html def test_question_translation_html(): assertions = {