forked from tursodatabase/libsql-client-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://pre-commit.com/ is a nice tool that can be installed and used as git-hook as well as executed as a GitHub Action, unifying how to validate our development efforts. Please install pre-commit in your system, then run: pre-commit install See https://pre-commit.com/#install
- Loading branch information
Showing
4 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
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,35 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
default_install_hook_types: [pre-commit, pre-push, pre-merge-commit] | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.3.0 | ||
hooks: | ||
- id: mypy | ||
exclude: "^(tests|examples|docs|hrana-test-server)/" | ||
|
||
- repo: local | ||
hooks: | ||
- id: run-tests | ||
name: run-tests | ||
entry: ./scripts/run-tests.sh | ||
exclude: ^(examples|docs|hrana-test-server)/ | ||
language: script | ||
pass_filenames: false | ||
always_run: true | ||
types: [python] | ||
stages: [push, merge-commit] | ||
|
||
- repo: local | ||
hooks: | ||
- id: run-examples | ||
name: run-examples | ||
entry: ./scripts/run-examples.sh | ||
exclude: ^(tests|docs|hrana-test-server)/ | ||
language: script | ||
pass_filenames: false | ||
always_run: true | ||
types: [python] | ||
stages: [push, merge-commit] |
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,21 @@ | ||
#!/bin/bash | ||
|
||
export URL="ws://localhost:8080" | ||
EXAMPLES=( | ||
examples/books.py | ||
examples/readme.py | ||
examples/dbapi2.py | ||
) | ||
|
||
function die() { | ||
echo "ERROR: $*" 1>&2 | ||
exit 1 | ||
} | ||
|
||
for e in ${EXAMPLES[@]}; do | ||
echo -e "\nEXAMPLE: $e" | ||
poetry run \ | ||
python hrana-test-server/server_v2.py \ | ||
python $e || | ||
die "failed to execute $e" | ||
done |
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,14 @@ | ||
#!/bin/bash | ||
|
||
PY_MIN_VER=`python -c "import sys; print(sys.version_info[1])"` | ||
|
||
OPTS=("--verbose") | ||
if [ "$PY_MIN_VER" -lt 11 ]; then | ||
# tests/dbapi2 are based on cpython-3.11 test suite | ||
OPTS+=("--ignore" "tests/dbapi2") | ||
fi | ||
|
||
set -x | ||
exec poetry run \ | ||
python hrana-test-server/server_v2.py \ | ||
pytest "${OPTS[@]}" |