-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1110e53
commit fa93daa
Showing
24 changed files
with
578 additions
and
261 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: basic test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
simple-checks: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- uses: pre-commit/[email protected] | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
needs: simple-checks | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# 'Basic' tests and checks | ||
- TOXENV: py3 | ||
TOXCFG: tox.ini | ||
|
||
env: | ||
TOXENV: ${{ matrix.TOXENV }} | ||
TOXCFG: ${{ matrix.TOXCFG }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-${{ matrix.TOXENV }} | ||
with: | ||
path: .tox | ||
key: ${{ runner.os }}-tox-${{ env.cache-name }}-${{ hashFiles('pyproject.toml', 'requirements.in') }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.in') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: install deps | ||
run: | | ||
pip install uv | ||
uv pip install --system -r constraints.txt | ||
- name: tox | ||
run: | | ||
tox -c ${TOXCFG} -e ${TOXENV} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
repos: | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
args: | ||
- --py38-plus | ||
files: "tavern/.*" | ||
- repo: https://github.com/rhysd/actionlint | ||
rev: v1.6.27 | ||
hooks: | ||
- id: actionlint | ||
args: ["-shellcheck="] | ||
- repo: https://github.com/hadialqattan/pycln | ||
rev: v2.4.0 | ||
hooks: | ||
- id: pycln | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: "v0.3.4" | ||
hooks: | ||
- id: ruff-format | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0 | ||
hooks: | ||
- id: prettier | ||
types_or: [yaml] | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.9.0 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: | ||
[types-requests, types-protobuf, types-PyYAML, mypy-extensions] | ||
exclude: tests | ||
|
||
exclude: (docs/|example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contributing | ||
|
||
All configuration for the project should be put into `pyproject.toml`. | ||
|
||
## Working locally | ||
|
||
1. Create a virtualenv using whatever method you like ( | ||
eg, [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/)) | ||
|
||
1. Install dependencies from requirements.txt | ||
|
||
## Updating/adding a dependency | ||
|
||
1. Add or update the dependency in [pyproject.toml](/pyproject.toml) | ||
|
||
1. Update constraints file | ||
|
||
```shell | ||
uv pip compile --all-extras pyproject.toml --output-file constraints.txt -U | ||
``` | ||
|
||
## Pre-commit | ||
|
||
Basic checks (formatting, import order) is done with pre-commit and is controlled by [the yaml file](/.pre-commit-config.yaml). | ||
|
||
After installing dependencies, Run | ||
|
||
# check it works | ||
pre-commit run --all-files | ||
pre-commit install | ||
|
||
Run every so often to update the pre-commit hooks | ||
|
||
pre-commit autoupdate | ||
|
||
### Fixing Python formatting issue | ||
|
||
ruff format tavern/ tests/ | ||
ruff --fix tavern/ tests/ | ||
|
||
### Fix yaml formatting issues | ||
|
||
pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# This file was autogenerated by uv via the following command: | ||
# uv pip compile --all-extras pyproject.toml --output-file constraints.txt | ||
attrs==23.2.0 | ||
# via | ||
# jsonschema | ||
# pytest | ||
# referencing | ||
blinker==1.7.0 | ||
# via flask | ||
cachetools==5.3.3 | ||
# via tox | ||
certifi==2024.2.2 | ||
# via requests | ||
cfgv==3.4.0 | ||
# via pre-commit | ||
chardet==5.2.0 | ||
# via tox | ||
charset-normalizer==3.3.2 | ||
# via requests | ||
click==8.1.7 | ||
# via flask | ||
colorama==0.4.6 | ||
# via tox | ||
colorlog==6.8.2 | ||
distlib==0.3.8 | ||
# via virtualenv | ||
docopt==0.6.2 | ||
# via pykwalify | ||
docutils==0.20.1 | ||
# via flit | ||
exceptiongroup==1.2.0 | ||
# via pytest | ||
filelock==3.13.3 | ||
# via | ||
# tox | ||
# virtualenv | ||
flask==3.0.2 | ||
flit==3.9.0 | ||
flit-core==3.9.0 | ||
# via flit | ||
identify==2.5.35 | ||
# via pre-commit | ||
idna==3.6 | ||
# via requests | ||
iniconfig==2.0.0 | ||
# via pytest | ||
itsdangerous==2.1.2 | ||
# via flask | ||
jinja2==3.1.3 | ||
# via flask | ||
jmespath==1.0.1 | ||
# via tavern | ||
jsonschema==4.21.1 | ||
# via tavern | ||
jsonschema-specifications==2023.12.1 | ||
# via jsonschema | ||
markupsafe==2.1.5 | ||
# via | ||
# jinja2 | ||
# werkzeug | ||
nodeenv==1.8.0 | ||
# via pre-commit | ||
packaging==24.0 | ||
# via | ||
# pyproject-api | ||
# pytest | ||
# tox | ||
paho-mqtt==1.6.1 | ||
# via tavern | ||
pbr==6.0.0 | ||
# via stevedore | ||
platformdirs==4.2.0 | ||
# via | ||
# tox | ||
# virtualenv | ||
pluggy==1.4.0 | ||
# via | ||
# pytest | ||
# tox | ||
pre-commit==3.7.0 | ||
pyjwt==2.8.0 | ||
# via tavern | ||
pykwalify==1.8.0 | ||
# via tavern | ||
pyproject-api==1.6.1 | ||
# via tox | ||
pytest==7.2.2 | ||
# via tavern | ||
python-box==6.1.0 | ||
# via tavern | ||
python-dateutil==2.9.0.post0 | ||
# via pykwalify | ||
pyyaml==6.0.1 | ||
# via | ||
# pre-commit | ||
# tavern | ||
referencing==0.34.0 | ||
# via | ||
# jsonschema | ||
# jsonschema-specifications | ||
requests==2.31.0 | ||
# via | ||
# flit | ||
# tavern | ||
rpds-py==0.18.0 | ||
# via | ||
# jsonschema | ||
# referencing | ||
ruamel-yaml==0.18.6 | ||
# via pykwalify | ||
ruamel-yaml-clib==0.2.8 | ||
# via ruamel-yaml | ||
ruff==0.3.4 | ||
setuptools==69.2.0 | ||
# via nodeenv | ||
six==1.16.0 | ||
# via python-dateutil | ||
stevedore==4.1.1 | ||
# via tavern | ||
tavern==2.10.1 | ||
tomli==2.0.1 | ||
# via | ||
# pyproject-api | ||
# pytest | ||
# tox | ||
tomli-w==1.0.0 | ||
# via flit | ||
tox==4.14.2 | ||
urllib3==2.2.1 | ||
# via requests | ||
uv==0.1.24 | ||
virtualenv==20.25.1 | ||
# via | ||
# pre-commit | ||
# tox | ||
werkzeug==3.0.1 | ||
# via flask | ||
wheel==0.43.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
# Example flask server | ||
|
||
To run the docker based tests, do: | ||
|
||
1. `docker-compose up --build .` | ||
2. `py.test` | ||
|
||
To run the tests using tavern-flask, do: | ||
|
||
1. `py.test --tavern-http-backend=flask`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.