-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
76 lines (63 loc) · 1.69 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""Nox configuration."""
from __future__ import annotations
import os
import sys
from textwrap import dedent
import nox
try:
from nox_poetry import Session, session
except ImportError:
message = f"""\
Nox failed to import the 'nox-poetry' package.
Please install it using the following command:
{sys.executable} -m pip install nox-poetry"""
raise SystemExit(dedent(message)) from None
package = "tap-jotform"
src_dir = "tap_jotform"
tests_dir = "tests"
python_versions = [
"3.13",
"3.12",
"3.11",
"3.10",
"3.9",
"3.8",
]
main_python_version = "3.12"
locations = src_dir, tests_dir, "noxfile.py"
nox.options.sessions = (
"mypy",
"tests",
)
@session(python=main_python_version)
def run(session: Session) -> None:
"""Run the tap with request caching enabled."""
session.install(".")
session.run(
"tap-jotform",
"--config",
"requests_cache.config.json",
"--config",
"ENV",
)
@session(python=python_versions)
def mypy(session: Session) -> None:
"""Check types with mypy."""
args = session.posargs or [src_dir, tests_dir]
session.install(".")
session.install(
"mypy",
"types-requests",
)
session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
@session(python=python_versions)
def tests(session: Session) -> None:
"""Execute pytest tests and compute coverage."""
deps = ["pytest"]
if "GITHUB_ACTIONS" in os.environ:
deps.append("pytest-github-actions-annotate-failures")
session.install(".")
session.install(*deps)
session.run("pytest", *session.posargs)