summaryrefslogtreecommitdiff
path: root/dev/commands.py
blob: ed9341a18379a659128ffff501de4ebf33ca4b42 (plain)
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
import pytest
import pylint
from subprocess import run

def dev_pylint():
    return pylint.run_pylint(argv=["-v", "src/miinaharava"])

def dev_pytest():
    return pytest.main(["-v"])

def dev_coverage():
    return run(
        "poetry run python3 -m coverage run --branch -m pytest -v ".split()
        ).returncode
    
def dev_covhtml():
    if e := dev_coverage(): return e
    return run(
        "poetry run python3 -m coverage html".split()
        ).returncode
    
def dev_covxml():
    if e := dev_coverage(): return e
    return run(
        "poetry run python3 -m coverage xml".split()
        ).returncode
    
def dev_covff():
    if e := dev_covhtml(): return e
    return run(
        "firefox htmlcov/index.html".split()
        ).returncode

def dev_all():
    if e := dev_covff(): return e
    return dev_pylint()