def createCoveragerc(crcpath): coveragerc = "#automatically created by devilry\n[run]\ninclude = {path!s}/*".format( path=getreporoot()) coveragercfile = open(crcpath, 'w') coveragercfile.write(coveragerc) coveragercfile.close()
from os.path import join, relpath, abspath import re print __file__ IGNOREPATT = ( 'devilry/static/jslibs/.+', 'devilry/static/superadminmedia/.+', 'devilry/devilryadmin/cmd_todolist.py' ) def ignore(fn): for patt in IGNOREPATT: if re.match(patt, fn): return True reporoot = getreporoot() p = Popen(['git', 'grep', '-l', 'TODO:'], stdout=PIPE, cwd=reporoot) stdout, stderr = p.communicate() matchingfiles = stdout.split() cwd = getcwd() chdir(reporoot) absmatchinfiles = [abspath(fn) for fn in matchingfiles] chdir(cwd) for rootrelpath, path in zip(matchingfiles, absmatchinfiles): if ignore(rootrelpath): continue print print '{0}:'.format(relpath(path)) for lineno, line in enumerate(open(join(reporoot, path))):
#!/usr/bin/env python # Create the simplified database (replaces current db) and dump it to the fixture used in tests. if __name__ == '__main__': from os.path import join from common import require_djangoproject, depends, Command, getreporoot, dumpfixture require_djangoproject() depends(Command('simplifiedtestdb')) fixturepath = join(getreporoot(), 'devilry', 'simplified', 'fixtures', 'simplified', 'data.json') dumpfixture(fixturepath, 'core', 'auth.user', 'grade_approved', 'grade_default', 'grade_rstschema')
def createCoveragerc(crcpath): coveragerc = "#automatically created by devilry\n[run]\ninclude = {path!s}/*".format(path=getreporoot()) coveragercfile = open(crcpath, "w") coveragercfile.write(coveragerc) coveragercfile.close()
from common import getreporoot from os import getcwd, chdir from os.path import join, relpath, abspath import re print __file__ IGNOREPATT = ('devilry/static/jslibs/.+', 'devilry/static/superadminmedia/.+', 'devilry/devilryadmin/cmd_todolist.py') def ignore(fn): for patt in IGNOREPATT: if re.match(patt, fn): return True reporoot = getreporoot() p = Popen(['git', 'grep', '-l', 'TODO:'], stdout=PIPE, cwd=reporoot) stdout, stderr = p.communicate() matchingfiles = stdout.split() cwd = getcwd() chdir(reporoot) absmatchinfiles = [abspath(fn) for fn in matchingfiles] chdir(cwd) for rootrelpath, path in zip(matchingfiles, absmatchinfiles): if ignore(rootrelpath): continue print print '{0}:'.format(relpath(path)) for lineno, line in enumerate(open(join(reporoot, path))):