コード例 #1
0
def make_report(
    test_args, source_dir='sympy/', report_dir='covhtml', use_cache=False,
    slow=False
    ):
    # code adapted from /bin/test
    from get_sympy import path_hack
    sympy_top = path_hack()
    os.chdir(sympy_top)

    cov = coverage.coverage()
    cov.exclude("raise NotImplementedError")
    cov.exclude("def canonize")  # this should be "@decorated"
    cov.exclude("def __mathml__")
    if use_cache:
        cov.load()
    else:
        cov.erase()
        cov.start()
        import sympy
        sympy.test(*test_args, subprocess=False, slow=slow)
        #sympy.doctest()  # coverage doesn't play well with doctests
        cov.stop()
        try:
            cov.save()
        except PermissionError:
            import warnings
            warnings.warn(
                "PermissionError has been raised while saving the " \
                "coverage result.",
                RuntimeWarning
            )

    covered_files = list(generate_covered_files(source_dir))
    cov.html_report(morfs=covered_files, directory=report_dir)
コード例 #2
0
def make_report(test_args,
                source_dir='sympy/',
                report_dir='covhtml',
                use_cache=False,
                slow=False):
    # code adapted from /bin/test
    from get_sympy import path_hack
    sympy_top = path_hack()
    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()
        import sympy
        sympy.test(*test_args, subprocess=False, slow=slow)
        #sympy.doctest()  # coverage doesn't play well with doctests
        cov.stop()
        try:
            cov.save()
        except PermissionError:
            import warnings
            warnings.warn(
                "PermissionError has been raised while saving the " \
                "coverage result.",
                RuntimeWarning
            )

    covered_files = list(generate_covered_files(source_dir))
    cov.html_report(morfs=covered_files, directory=report_dir)
コード例 #3
0
ファイル: sympy_time.py プロジェクト: 101man/sympy
import time
from get_sympy import path_hack
path_hack()

seen = set()
import_order = []
elapsed_times = {}
level = 0
parent = None
children = {}

def new_import(name, globals={}, locals={}, fromlist=[]):
    global level, parent
    if name in seen:
        return old_import(name, globals, locals, fromlist)
    seen.add(name)
    import_order.append((name, level, parent))
    t1 = time.time()
    old_parent = parent
    parent = name
    level += 1
    module = old_import(name, globals, locals, fromlist)
    level -= 1
    parent = old_parent
    t2 = time.time()
    elapsed_times[name] = t2-t1
    return module

old_import = __builtins__.__import__

__builtins__.__import__ = new_import
コード例 #4
0
from timeit import default_timer as clock
from get_sympy import path_hack

path_hack()
t = clock()
import sympy

t = clock() - t
print t
コード例 #5
0
ファイル: test_executable.py プロジェクト: Daaofer/sympyTest
#!/usr/bin/env python
"""
Test that only executable files have an executable bit set
"""
from __future__ import print_function

import os
import sys

from get_sympy import path_hack

base_dir = path_hack()


def test_executable(path):
    if not os.path.isdir(path):
        if os.access(path, os.X_OK):
            with open(path, 'r') as f:
                if f.readline()[:2] != "#!":
                    exn_msg = "File at " + path + " either should not be executable or should have a shebang line"
                    raise SystemError(exn_msg)
    else:
        for file in os.listdir(path):
            test_executable(os.path.join(path, file))


test_executable(base_dir)
コード例 #6
0
ファイル: test_executable.py プロジェクト: Lenqth/sympy
#!/usr/bin/env python
"""
Test that only executable files have an executable bit set
"""
from __future__ import print_function

import os
import sys

from get_sympy import path_hack
base_dir = path_hack()

def test_executable(path):
    if not os.path.isdir(path):
        if os.access(path, os.X_OK):
            with open(path, 'r') as f:
                if f.readline()[:2] != "#!":
                    exn_msg = "File at " + path + " either should not be executable or should have a shebang line"
                    raise SystemError(exn_msg)
    else:
        for file in os.listdir(path):
            test_executable(os.path.join(path, file))

test_executable(base_dir)