fixed typeguard usage w/ burnettk

This commit is contained in:
jasquat 2022-05-20 11:46:44 -04:00
parent cf2054458f
commit 8fd3e14935
4 changed files with 15 additions and 3 deletions

View File

@ -61,7 +61,10 @@ jobs:
database: "sqlite",
}
- {
python: "3.10",
# typeguard 2.13.3 is broken with TypeDict in 3.10.
# probably the next release fixes it.
# https://github.com/agronholm/typeguard/issues/242
python: "3.9",
os: "ubuntu-latest",
session: "typeguard",
database: "sqlite",

View File

@ -3,8 +3,16 @@ import os
import pytest
from flask.app import Flask
from typeguard.importhook import install_import_hook
from spiff_workflow_webapp import create_app
# We need to call this before importing spiff_workflow_webapp
# otherwise typeguard cannot work. hence the noqa: E402
if os.environ.get("RUN_TYPEGUARD") == "true":
install_import_hook(packages="spiff_workflow_webapp")
from spiff_workflow_webapp import create_app # noqa: E402
@pytest.fixture(scope="session")

View File

@ -156,7 +156,8 @@ def typeguard(session: Session) -> None:
"""Runtime type checking using Typeguard."""
session.install(".")
session.install("pytest", "typeguard", "pygments")
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
session.env["RUN_TYPEGUARD"] = "true"
session.run("pytest", *session.posargs)
@session(python=python_versions)

Binary file not shown.