Skip to content

Commit

Permalink
Add preliminary test suite
Browse files Browse the repository at this point in the history
Includes the following fixes uncovered while writing tests:

- Fix an issue where `ChromaLocation.get_offsets` would throw an error
  on 4:4:4 subsampling
- Fix an issue where `scale_value` could return values outside a valid
  range when converting to float
- Fix an issue where `scale_value` was returning floats for integer
  sample types
  • Loading branch information
shssoichiro committed Oct 7, 2024
1 parent f9a47e9 commit c43646d
Show file tree
Hide file tree
Showing 17 changed files with 985 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ jobs:
pip install -r requirements-dev.txt
pip install --force git+https://github.com/Setsugennoao/stgpytools.git
- name: Running flake8
run: flake8 vstools
run: |
flake8 vstools
flake8 tests
- name: Running mypy
run: |
echo "::add-matcher::.github/workflows/matchers/mypy.json"
mypy --no-pretty vstools
mypy --no-pretty tests
echo "::remove-matcher owner=mypy::"
continue-on-error: true
- name: Smoke test
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test

on: [push, pull_request]

jobs:
windows:
runs-on: windows-latest
strategy:
matrix:
versions:
- 68
python-version:
- '3.12'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install vapoursynth-portable==${{ matrix.versions }}
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Running tests
run: pytest tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ dmypy.json

# code editors
.vscode/
.idea/

# Pyre type checker
.pyre/
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = .
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ mypy>=1.11.2
mypy-extensions>=1.0.0
packaging>=24.0
pycodestyle>=2.11.1
pytest>=7.3.1
pytest-cov>=5.0.0
typing-extensions>=4.12.2
Loading

0 comments on commit c43646d

Please sign in to comment.