From 127d19cc0880aeac7b7e929e60afc9e3891c1b9f Mon Sep 17 00:00:00 2001 From: Inga Ulusoy Date: Tue, 28 May 2024 13:34:11 +0200 Subject: [PATCH] fix autograder issues --- .github/workflows/classroom.yml | 14 ++++++++------ pytest.ini | 3 +++ requirements.txt | 3 ++- tests/test_linter_formatter.py | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 pytest.ini diff --git a/.github/workflows/classroom.yml b/.github/workflows/classroom.yml index 6492c23..e5fa3b8 100644 --- a/.github/workflows/classroom.yml +++ b/.github/workflows/classroom.yml @@ -13,15 +13,17 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: check-for-stylistic-errors - id: check-for-stylistic-errors - uses: classroom-resources/autograding-python-grader@v1 + - name: test code formatting + id: test-code-formatting + uses: classroom-resources/autograding-command-grader@v1 with: + test-name: test code formatting + setup-command: 'pip install -r requirements.txt' + command: python -m pytest -m "not skipautograding" timeout: 10 - setup-command: 'pip install flake8 flake8-nb' - name: Autograding Reporter uses: classroom-resources/autograding-grading-reporter@v1 env: - CHECK-FOR-STYLISTIC-ERRORS_RESULTS: "${{steps.check-for-stylistic-errors.outputs.result}}" + TEST-CODE-FORMATTING_RESULTS: "${{steps.test-code-formatting.outputs.result}}" with: - runners: check-for-stylistic-errors + runners: test-code-formatting \ No newline at end of file diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..0b37e4f --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +markers = + skipautograding: disable tests for autograding since environment is not consistent \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index fe3757d..12a4f25 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ pytest black -flake8 \ No newline at end of file +flake8 +flake8-nb \ No newline at end of file diff --git a/tests/test_linter_formatter.py b/tests/test_linter_formatter.py index afe60d8..56d1bea 100644 --- a/tests/test_linter_formatter.py +++ b/tests/test_linter_formatter.py @@ -1,6 +1,7 @@ import os import re import subprocess +import pytest from pathlib import Path @@ -23,6 +24,7 @@ def test_flake8(): print("No stylistic errors found!") assert failure == 0 +@pytest.mark.skipautograding def test_flake8_nb(): # Get the repository directory current_dir = Path(__file__).resolve().parents[1]