From 9b0e2a891be535cbf49e74eaa5f09f2401bc6c6a Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Mon, 14 Oct 2024 12:04:24 -0400 Subject: [PATCH] Add test framework --- .github/workflows/lint.yml | 4 +++- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- pytest.ini | 2 ++ requirements-dev.txt | 2 ++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 pytest.ini diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 35d3610..17491c0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,4 +36,6 @@ jobs: pip install -r requirements-dev.txt - name: Running ruff - run: ruff check vsscale + run: | + ruff check vsscale + ruff check tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b3199db --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Test Python code + +on: + push: + branches: + - master + paths: + - '**.py' + pull_request: + paths: + - '**.py' + +jobs: + windows: + runs-on: windows-latest + strategy: + matrix: + vs-versions: + - 68 + python-version: + - '3.12' + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + pip install vapoursynth-portable==${{ matrix.vs-versions }} + pip install -r requirements.txt + pip install -r requirements-dev.txt + + - name: Running tests + run: pytest --cov-report=term-missing:skip-covered --cov=vsscale tests + + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2.3.1 diff --git a/.gitignore b/.gitignore index 065ce53..2468aff 100644 --- a/.gitignore +++ b/.gitignore @@ -128,8 +128,9 @@ dmypy.json # Local test file *test*.py -# vscode folder +# Editor local configs .vscode +.idea # vsjet folder .vsjet/ diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..a635c5c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = . diff --git a/requirements-dev.txt b/requirements-dev.txt index a2f94d9..20e28d7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,5 @@ packaging>=24.0 pycodestyle>=2.11.1 +pytest>=7.3.1 +pytest-cov>=5.0.0 ruff>=0.6.5