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

Setup Testing #84

Merged
merged 35 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7348143
configure tests and add base fixtures
seapagan May 29, 2023
9663072
update test dependencies
seapagan May 29, 2023
8e05591
add root route integration test
seapagan May 29, 2023
f0de647
pin sqlalchemy lib to version 1 only
seapagan May 29, 2023
5aeffab
add auth routes integration tests
seapagan May 29, 2023
a8170e2
Pytest : always generate coverage data and HTML
seapagan May 29, 2023
7cd5b28
add GitHub Action to run tests
seapagan May 29, 2023
6f8876b
remove tests from coverage totals
seapagan May 29, 2023
9efb0dd
rename CI action to Tests and add coverage report
seapagan May 30, 2023
0a2586d
fix tests badge
seapagan May 30, 2023
e5a5688
try fix coverage uploading
seapagan May 30, 2023
3ff3209
add code coverage badge
seapagan May 30, 2023
07802a6
add codecov token
seapagan May 30, 2023
4e72cd9
add custom coverage upload name
seapagan May 30, 2023
48fdf5a
change some code-style linting issues
seapagan May 30, 2023
ff11425
more code-style issue fixes
seapagan May 30, 2023
48b025b
tidy test_auth_routes
seapagan May 30, 2023
bfc22f2
fix wrong comment in test_auth_routes
seapagan May 30, 2023
42f1ec8
add more specific .pylintrc
seapagan May 30, 2023
a128a06
add tests for EmailManager
seapagan May 30, 2023
a26e580
add basic test info to README
seapagan May 30, 2023
82ac4e6
make token expiry a config setting
seapagan May 30, 2023
aa8ce36
fix banned users getting token on login
seapagan May 30, 2023
105534e
more tests for auth route
seapagan May 30, 2023
c0600ea
wip on UserManager tests
seapagan Jun 1, 2023
3ce163a
get dependabot and pre-commit.ci to coexist
seapagan Jun 1, 2023
86f9be2
Merge branch 'main' into add_tests
seapagan Jun 1, 2023
09189dd
add ability to use Postgresql for tests
seapagan Jun 1, 2023
3547cc6
update skip reason for one test
seapagan Jun 1, 2023
0b12f11
catch sqlite duplicate email error and test it
seapagan Jun 2, 2023
fee0e72
[pre-commit.ci] auto fixes from pre-commit.com hooks [dependabot skip]
pre-commit-ci[bot] Jun 2, 2023
7d4fe86
work on a copy of the posted registration data
seapagan Jun 2, 2023
fd80b29
exception if try to set banned to current value
seapagan Jun 2, 2023
89f0bc4
Complete 100% test coverage for UserManager
seapagan Jun 2, 2023
c3ca6b3
use ErrorMessages in tests instead of strings
seapagan Jun 2, 2023
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
67 changes: 67 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Tests

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
# ---------------------------------------------------------------------- #
# checkout repo and setup Python #
# ---------------------------------------------------------------------- #
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# ---------------------------------------------------------------------- #
# install and configure poetry #
# ---------------------------------------------------------------------- #
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
# ---------------------------------------------------------------------- #
# load cached venv if cache exists #
# ---------------------------------------------------------------------- #
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key:
venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version
}}-${{ hashFiles('**/poetry.lock') }}
# ---------------------------------------------------------------------- #
# install dependencies if cache does not exist #
# ---------------------------------------------------------------------- #
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

# ---------------------------------------------------------------------- #
# run Pytest #
# ---------------------------------------------------------------------- #
- name: Test with pytest
run: |
poetry run pytest --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-python-${{ matrix.python-version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,4 @@ cython_debug/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

openapi.json
test.db
Loading