def task_pycov(): ''' run pycov ''' return dict(actions=[ fmt('pytest {PYTHON} -m pytest -s -vv --cov={ZSDIR} {TESTDIR}'), ], )
def task_pytest(): ''' run pytest ''' return dict(actions=[ fmt('{PYTHON} -m pytest -s -vv {TESTDIR}'), ], )
def task_list_pyfiles(): ''' print all of the pyfiles ''' text = '\n'.join(pyfiles()) return dict(actions=[ fmt('echo "{text}"'), ], )
def task_rmcache(): ''' remove pycache files ''' cachedirs = rglob('**/__pycache__') print('cachedirs =', cachedirs) return dict(actions=[ fmt('{RMRF} **/__pycache__'), ], )
def task_pylint(): ''' run pylint ''' for pyfile in pyfiles(): yield dict( name=pyfile, actions=[ fmt('pylint -j{J} --rcfile {TESTDIR}/pylint.rc {pyfile}'), ], )
from glob import glob from doit.task import clean_targets from zs.utils.fmt import fmt from zs.utils.shell import cd, call, rglob, globs, which DOIT_CONFIG = { 'verbosity': 2, 'default_tasks': ['test'], } DODO = 'dodo.py' PYTHON = which('python3') REPOROOT = os.path.dirname(os.path.abspath(__file__)) ZSDIR = fmt('{REPOROOT}/zs') TESTDIR = fmt('{REPOROOT}/tests') BINDIR = fmt('{REPOROOT}/bin') try: J = call('nproc')[1].strip() except: J = 1 try: RMRF = which('rmrf') except: RMRF = 'rm -rf' def pyfiles():