-
Notifications
You must be signed in to change notification settings - Fork 192
/
tasks.py
43 lines (37 loc) · 968 Bytes
/
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from invoke import task
if os.name == 'nt': # Windows
py = "python"
else:
py = "python3"
@task
def coverage(c, details=False, gui=False):
c.run("coverage erase")
c.run("coverage run -m pytest --ignore tests-gui")
if gui:
c.run("coverage run -a -m unittest tests-gui.gui_app_test")
if details:
c.run("coverage annotate")
c.run("coverage report", pty=True)
@task
def test(c):
coverage(c)
@task
def lint(c):
run_arg = "pylint -j 4 nut/Config.py tests/ nut/Nsps.py nut/Hex.py nut_gui.py \
gui/panes/dirlist.py gui/panes/filters.py gui/panes/format.py Fs/driver/http.py \
nut/config_impl/download.py gui/table_model.py gui/header.py gui/app.py \
gui/panes/options.py"
if os.name == 'nt': # Windows
c.run(run_arg)
else:
c.run(run_arg, pty=True)
@task
def run(c, gui=True):
run_arg = f"{py} nut_gui.py"
if os.name == 'nt': # Windows
c.run(run_arg)
else:
c.run(run_arg, pty=True)