Skip to content

Commit

Permalink
Base extension, assertions, and helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Oct 23, 2024
1 parent 2b1fc2d commit 16df139
Show file tree
Hide file tree
Showing 17 changed files with 453 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint Python code with Ruff

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 ruff
run: ruff check vsunittest
16 changes: 16 additions & 0 deletions .github/workflows/matchers/mypy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "mypy",
"pattern": [
{
"regexp": "^(.+):(\\d+):\\s(error|warning|note):\\s(.+)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
]
}
]
}
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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=vsunittest tests

- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
151 changes: 151 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
*ffindex
.vsjet/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# code editors
.vscode/
.idea/

# Pyre type checker
.pyre/

# Local test file
*test*.py

# Unignore tests dir
!tests/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Jaded Encoding Thaumaturgy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# vs-unittest

[![Coverage Status](https://coveralls.io/repos/github/Jaded-Encoding-Thaumaturgy/vs-unittest/badge.svg?branch=master)](https://coveralls.io/github/Jaded-Encoding-Thaumaturgy/vs-unittest?branch=master)

This module contains utilities for writing unittest for VapourSynth scripts.

For support you can check out the [JET Discord server](https://discord.gg/XTpc6Fa9eB). <br><br>

## How to install

Install `vsunittest` with the following command:

```sh
pip install vsunittest
```

Or if you want the latest git version, install it with this command:

```sh
pip install git+https://github.com/Jaded-Encoding-Thaumaturgy/vs-unittest.git
```
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = .
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packaging>=24.0
pycodestyle>=2.11.1
ruff>=0.6.5
pytest-cov>=5.0.0
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VapourSynth>=68
pytest>=7.3.1
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

import setuptools
from pathlib import Path

package_name = 'vsunittest'

exec(Path(f'{package_name}/_metadata.py').read_text(), meta := dict[str, str]())

readme = Path('README.md').read_text()
requirements = Path('requirements.txt').read_text()


setuptools.setup(
name=package_name,
version=meta['__version__'],
author=meta['__author_name__'],
author_email=meta['__author_email__'],
maintainer=meta['__maintainer_name__'],
maintainer_email=meta['__maintainer_email__'],
description=meta['__doc__'],
long_description=readme,
long_description_content_type='text/markdown',
project_urls={
'Source Code': 'https://github.com/Jaded-Encoding-Thaumaturgy/vs-unittest',
'Contact': 'https://discord.gg/XTpc6Fa9eB',
},
install_requires=requirements,
python_requires='>=3.12',
packages=[
package_name,
],
package_data={
package_name: ['py.typed']
},
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
)
6 changes: 6 additions & 0 deletions vsunittest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ruff: noqa: F401, F403

from .assertions import *
from .core import VSTestCase
from .types import *
from .utils import *
12 changes: 12 additions & 0 deletions vsunittest/_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Unittest utilities for VapourSynth."""

__version__ = '0.1.0'

__author_name__, __author_email__ = 'LightArrowsEXE', '[email protected]'
__maintainer_name__, __maintainer_email__ = __author_name__, __author_email__

__author__ = f'{__author_name__} <{__author_email__}>'
__maintainer__ = __author__

if __name__ == '__github__':
print(__version__)
Loading

0 comments on commit 16df139

Please sign in to comment.