Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring examples to be testable #579

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,27 @@ jobs:
- name: Run tests
run: |
bash ./bin/docker-compose-it.sh

example-tests:
name: Examples | Unit tests
needs: does-it-run
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install tox
- name: Run tests | ${{ matrix.python-version }}
run: |
find examples/ -name "tox.ini" -print0 | xargs -0 -t -I % -P 1 tox -e py,py-async -p all -c %
32 changes: 18 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
.PHONY: all clean test test-release release publish-test publish env
.PHONY: all clean style typing test test-release release publish-test publish env

VIRTUALENV_EXISTS := $(shell [ -d .venv ] && echo 1 || echo 0)

all: clean test
@python -c "print('OK')"

clean:
@python setup.py clean
@find src/ -name "*.so" | xargs rm -rf
@find . -name "*.pyc" | xargs rm -rf
@find . -name "__pycache__" | xargs rm -rf
@find . -name ".coverage" | xargs rm -rf
@rm -rf .coverage coverage.* .eggs/ .mypy_cache/ .pytype/ .ruff_cache/ .pytest_cache/ .tox/ src/Flask_JSONRPC.egg-info/ htmlcov/ junit/ htmldoc/ build/ dist/ wheelhouse/
@find {src,examples,tests} -regex ".*\.\(so\|pyc\)" | xargs rm -rf
@find {src,examples,tests} -name "__pycache__" -o -name ".coverage" -o -name ".tox" -o -name ".pytest_cache" -o -name ".ruff_cache" -o -name ".pkg" -o -name ".tmp" | xargs rm -rf
@rm -rf .coverage coverage.* .eggs/ .mypy_cache/ .pytype/ .ruff_cache/ .pytest_cache/ .tox/ src/*.egg-info/ htmlcov/ junit/ htmldoc/ build/ dist/ wheelhouse/

style:
@ruff check .
@ruff format .

typing:
@mypy --install-types --non-interactive src/

test: clean
@python -m pip install --upgrade tox
@python -m tox
@python -m tox -p all

test-examples: clean
@python -m pip install --upgrade tox
@find examples/ -name "tox.ini" -print0 | xargs -0 -t -I % -P 4 tox -p all -c %

test-release: clean test
@docker-compose -f docker-compose.test.yml build --build-arg VERSION=$(shell date +%s)
@docker-compose -f docker-compose.test.yml up
test-release: test
$(shell ./bin/docker-compose-test.sh)
$(shell ./bin/docker-compose-it.sh)

release: clean test
release: test
@python -m pip install --upgrade -r requirements/cbuild.txt
@python -m build
@MYPYC_ENABLE=1 python setup.py bdist_wheel

publish-test: clean release
publish-test: release
@python -m pip install --upgrade twine
@python -m twine upload --repository testpypi dist/*

publish: clean release
publish: release
@python -m pip install --upgrade twine
@python -m twine upload dist/*

Expand Down
104 changes: 0 additions & 104 deletions examples/async/README.rst

This file was deleted.

81 changes: 0 additions & 81 deletions examples/async/async_minimal.py

This file was deleted.

58 changes: 0 additions & 58 deletions examples/auth/README.rst

This file was deleted.

Loading
Loading