-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
40 lines (29 loc) · 1 KB
/
tasks.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
"""Invoke-based tasks."""
from invoke import task
stuff_to_analyze = "exact_cover_solver/ performance_tests/ tests/ tasks.py"
@task
def test(ctx):
"""Run unit tests."""
ctx.run("pytest --cov=exact_cover_solver tests")
@task
def format(ctx):
"""Format project with black code formatter."""
ctx.run(f"black {stuff_to_analyze}")
@task
def lint(ctx):
"""Lint project with flake8, black and mypy."""
ctx.run(
f"flake8 {stuff_to_analyze}; black --check {stuff_to_analyze}; "
"mypy exact_cover_solver/"
)
@task
def cov(ctx):
"""Generate coverage report based on test results."""
ctx.run("python3 -m pytest --cov=exact_cover_solver tests --cov-report html")
@task
def docs(ctx):
"""Generate docs with pdoc and move them to correct folder."""
ctx.run("if [[ -e pdoc/ ]]; then rm -r pdoc/; fi")
ctx.run("pdoc --html --force --output-dir pdoc exact_cover_solver")
ctx.run("cp -vaR pdoc/exact_cover_solver/. pdoc/")
ctx.run("rm -r pdoc/exact_cover_solver")