-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
58 lines (44 loc) · 1.32 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from invoke import task
@task(aliases=["i"])
def install(c):
c.run("pip install -r requirements.txt")
@task(aliases=["u"])
def update_pip(c):
print("Updating dependencies...")
c.run("pip install --upgrade pip")
@task(aliases=["c"])
def clean(c):
print("Cleaning up...")
c.run("rm -f *.png")
c.run("rm -rf coverage")
c.run("rm -rf dist")
c.run("rm -f .coverage")
c.run("rm -f coverage.xml")
c.run("rm -rf htmlcov")
c.run("rm -rf tests/htmlcov")
c.run("rm -rf tests/.pytest_cache")
c.run("rm -rf ./.pytest_cache")
c.run("rm -f tests/coverage.xml")
@task(aliases=["t"])
def test(c):
"""Runs PyTest unit tests."""
c.run("pytest tests")
@task(aliases=["v"])
def coverage(c):
"""Runs PyTest unit and integration tests with coverage."""
c.run("coverage run -m pytest")
c.run("coverage lcov -o ./coverage/lcov.info")
@task(aliases=["l"])
def lint(c):
print("Linting...")
c.run(
"flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics"
)
c.run(
"flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics"
)
@task(aliases=["b"], pre=[clean, lint, coverage], default=True)
def build(c):
print("Building the project")
c.run("python3 -m pip install --upgrade build")
c.run("python -m build")