Linters, Pytest conf

This commit is contained in:
Roman 2024-12-13 11:26:41 +08:00
parent f0981730fd
commit 468d96bf6c
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
5 changed files with 72 additions and 0 deletions

9
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,9 @@
## PR Details
<!--
Describe in details the feature or scenario that this PR is automating tests for.
-->
## Issues reported:
<!-- Issues found while working for this PR -->

33
.github/workflows/linters.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Code Linters
on:
pull_request:
branches:
- master
jobs:
linters:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Set up virtual environment
run: |
python -m venv .venv
echo ".venv/bin" >> $GITHUB_PATH # Add virtualenv to PATH for subsequent steps
- name: Install dependencies based on requirements.txt
run: pip install -r requirements.txt
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files

11
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,11 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
args: [--line-length=150]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.326
hooks:
- id: pyright

11
pyrightconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"include": ["src", "tests"],
"reportMissingImports": true,
"reportOptionalMemberAccess": false,
"reportGeneralTypeIssues": false,
"reportInvalidStringEscapeSequence": false,
"reportWildcardImportFromLibrary": false,
"venvPath": ".",
"venv": ".venv",
"typeCheckingMode": "off"
}

8
pytest.ini Normal file
View File

@ -0,0 +1,8 @@
[pytest]
addopts = -s --instafail --tb=short --color=auto
log_level = DEBUG
log_cli = True
log_file = log/test.log
log_cli_format = %(asctime)s %(name)s %(levelname)s %(message)s
log_file_format = %(asctime)s %(name)s %(levelname)s %(message)s
timeout = 300