-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
62 lines (39 loc) · 1.14 KB
/
tasks.py
File metadata and controls
62 lines (39 loc) · 1.14 KB
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
from sys import platform
from invoke import task
@task
def precommit_install(c):
"""Install pre-commit hooks."""
c.run("pre-commit install")
@task(aliases=["cc"])
def code_check(c):
"""Run coding conventions checks."""
c.run("pre-commit run --all-files")
@task
def test(c, cov=False):
_run_pytest(c, "tests", cov)
@task(aliases=["ut"])
def unit_test(c, cov=False):
_run_pytest(c, "tests/unit", cov)
@task(aliases=["it"])
def integration_test(c, cov=False):
_run_pytest(c, "tests/integration", cov)
def _run_pytest(c, test_dir, cov=False):
c.run(f"pytest -xsv {test_dir} {_pytest_cov_options(cov)}", pty=_use_pty())
def _use_pty():
return platform != "win32"
def _pytest_cov_options(use_cov: bool):
if not use_cov:
return ""
return "--cov=group_terminal --cov-report=term"
@task
def build_docs(c):
"""Build documentation with MkDocs."""
c.run("mkdocs build")
@task
def serve_docs(c):
"""Serve documentation locally with MkDocs."""
c.run("mkdocs serve -a 0.0.0.0:8000")
@task
def deploy_docs(c):
"""Deploy documentation to GitHub Pages."""
c.run("mkdocs gh-deploy --force")