コード例 #1
0
def make_report(source_dir, report_dir, use_cache=False):
    #code adapted from /bin/test
    bin_dir = os.path.abspath(os.path.dirname(__file__))  # bin/
    sympy_top = os.path.split(bin_dir)[0]  # ../
    sympy_dir = os.path.join(sympy_top, 'sympy')  # ../sympy/
    if os.path.isdir(sympy_dir):
        sys.path.insert(0, sympy_top)
    os.chdir(sympy_top)

    cov = coverage.coverage()
    cov.exclude("raise NotImplementedError")
    cov.exclude("def canonize")  #this should be "@decorated"
    if use_cache:
        cov.load()
    else:
        cov.erase()
        cov.start()
        from sympy.utilities.runtests import test
        test(source_dir)
        #from sympy.utilities.runtests import doctest
        #doctest()        #coverage doesn't play well with doctests
        cov.stop()
        cov.save()

    covered_files = list(generate_covered_files(source_dir))

    if report_dir in os.listdir(os.curdir):
        for f in os.listdir(report_dir):
            if f.split('.')[-1] in ['html', 'css', 'js']:
                os.remove(os.path.join(report_dir, f))

    cov.html_report(morfs=covered_files, directory=report_dir)
コード例 #2
0
ファイル: coverage_report.py プロジェクト: Aang/sympy
def make_report(source_dir, report_dir, use_cache=False):
    #code adapted from /bin/test
    bin_dir = os.path.abspath(os.path.dirname(__file__))         # bin/
    sympy_top  = os.path.split(bin_dir)[0]      # ../
    sympy_dir  = os.path.join(sympy_top, 'sympy')  # ../sympy/
    if os.path.isdir(sympy_dir):
        sys.path.insert(0, sympy_top)
    os.chdir(sympy_top)

    cov = coverage.coverage()
    cov.exclude("raise NotImplementedError")
    cov.exclude("def canonize")      #this should be "@decorated"
    if use_cache:
        cov.load()
    else:
        cov.erase()
        cov.start()
        from sympy.utilities.runtests import test
        test(source_dir)
        #from sympy.utilities.runtests import doctest
        #doctest()        #coverage doesn't play well with doctests
        cov.stop()
        cov.save()

    covered_files = list(generate_covered_files(source_dir))

    if report_dir in os.listdir(os.curdir):
        for f in os.listdir(report_dir):
            if f.split('.')[-1] in ['html', 'css', 'js']:
                os.remove(os.path.join(report_dir, f))

    cov.html_report(morfs=covered_files, directory=report_dir)
コード例 #3
0
 def run(self):
     if test():
         # all regular tests run successfuly, so let's also run doctests
         # (if some regular test fails, the doctests are not run)
         doctest()
コード例 #4
0
ファイル: setup.py プロジェクト: rainly/sympy
 def run(self):
     if test():
         # all regular tests run successfuly, so let's also run doctests
         # (if some regular test fails, the doctests are not run)
         doctest()