-
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.
- Loading branch information
Showing
5 changed files
with
169 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/ checkout@v4 | ||
|
||
- name: Setup Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v4 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Load cached venv | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
poetry install --no-root | ||
- name: Run tests | ||
run: ./scripts/runtests.py | ||
|
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ venv* | |
.idea* | ||
tmp.png | ||
.DS_Store | ||
.coverage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,39 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
import pytest | ||
|
||
|
||
base = Path(__file__).absolute().parent.parent | ||
sys.path.extend([str(base)]) | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser("Run unit tests") | ||
parser.add_argument( | ||
"--no-coverage", action="store_true", help="Do not add in coverage options" | ||
) | ||
other_args, pytest_args = parser.parse_known_args() | ||
|
||
args = ["--durations=5", "-v", "--tb=short", "--color=yes"] | ||
|
||
args.extend(pytest_args) | ||
|
||
if all(arg.startswith("-") for arg in pytest_args): | ||
args.append("tests") | ||
|
||
has_config = any(arg.startswith("--cov-config") for arg in args) | ||
if not has_config and not other_args.no_coverage: | ||
args.extend(["--cov-config=pyproject.toml", "--cov=."]) | ||
|
||
print(f"pytest {' '.join(args)}", file=sys.stderr) | ||
|
||
return_value = pytest.main(args) | ||
|
||
raise SystemExit(return_value) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |