Exemplo n.º 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"
    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)
Exemplo n.º 2
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"
    cov.exclude("def __mathml__")
    if use_cache:
        cov.load()
    else:
        cov.erase()
        cov.start()
        import sympy
        sympy.test(source_dir, subprocess=False)
        #sympy.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)
Exemplo n.º 3
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)
Exemplo n.º 4
0
def make_report(source_dir, report_dir, use_cache=False, slow=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)

    import sympy
    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()
        sympy.test(source_dir, subprocess=False)
        if slow:
            sympy.test(source_dir, subprocess=False, slow=slow)
        #sympy.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)
Exemplo n.º 5
0
    def run(self):
        tests_successful = True

        try:
            if not sympy.test():
                # some regular test fails, so set the tests_successful
                # flag to false and continue running the doctests
                tests_successful = False

            if not sympy.doctest():
                tests_successful = False

            if not (sys.platform == "win32" or sys.version_info[0] == 3):
                # run Sage tests; Sage currently doesn't support Windows or Python 3
                dev_null = open(os.devnull, 'w')
                if subprocess.call("sage -v", shell = True, stdout = dev_null, stderr = dev_null) == 0:
                    if subprocess.call("sage -python bin/test sympy/external/tests/test_sage.py", shell = True) != 0:
                        tests_successful = False

            if tests_successful:
                return
            else:
                # Return nonzero exit code
                sys.exit(1)
        except KeyboardInterrupt:
            print
            print("DO *NOT* COMMIT!")
            sys.exit(1)
Exemplo n.º 6
0
Arquivo: setup.py Projeto: itsrg/sympy
 def run(self):
     if sympy.test():
         # all regular tests run successfuly, so let's also run doctests
         # (if some regular test fails, the doctests are not run)
         if sympy.doctest():
             # All ok
             return
     # Return nonzero exit code
     sys.exit(1)
Exemplo n.º 7
0
    def run(self):
        tests_successful = True
        try:
            if not sympy.test():
                # some regular test fails, so set the tests_successful
                # flag to false and continue running the doctests
                tests_successful = False

            if not sympy.doctest():
                tests_successful = False

            if tests_successful:
                return
            else:
                # Return nonzero exit code
                sys.exit(1)
        except KeyboardInterrupt:
            print
            print("DO *NOT* COMMIT!")
            sys.exit(1)
Exemplo n.º 8
0
    def run(self):
        tests_successful = True
        try:
            if not sympy.test():
                # some regular test fails, so set the tests_successful
                # flag to false and continue running the doctests
                tests_successful = False

            if not sympy.doctest():
                tests_successful = False

            if tests_successful:
                return
            else:
                # Return nonzero exit code
                sys.exit(1)
        except KeyboardInterrupt:
            print
            print("DO *NOT* COMMIT!")
            sys.exit(1)
Exemplo n.º 9
0
    def run(self):
        tests_successful = True

        try:
            if not sympy.test():
                # some regular test fails, so set the tests_successful
                # flag to false and continue running the doctests
                tests_successful = False

            if not sympy.doctest():
                tests_successful = False

            print
            sys.path.append("examples")
            from all import run_examples  # examples/all.py
            if not run_examples(quiet=True):
                tests_successful = False

            if not (sys.platform == "win32" or sys.version_info[0] == 3):
                # run Sage tests; Sage currently doesn't support Windows or Python 3
                dev_null = open(os.devnull, 'w')
                if subprocess.call("sage -v",
                                   shell=True,
                                   stdout=dev_null,
                                   stderr=dev_null) == 0:
                    if subprocess.call(
                            "sage -python bin/test sympy/external/tests/test_sage.py",
                            shell=True) != 0:
                        tests_successful = False

            if tests_successful:
                return
            else:
                # Return nonzero exit code
                sys.exit(1)
        except KeyboardInterrupt:
            print
            print("DO *NOT* COMMIT!")
            sys.exit(1)
Exemplo n.º 10
0
#!/usr/bin/env python
"""
Run tests involving tensorflow

These are separate from the other optional dependency tests because tensorflow
pins the numpy version.
"""

# Add the local sympy to sys.path (needed for CI)
from get_sympy import path_hack
path_hack()


class TestsFailedError(Exception):
    pass


test_list = doctest_list = [
    'sympy/printing/tensorflow.py',
    'sympy/printing/tests/test_tensorflow.py',
    'sympy/stats/sampling',
    'sympy/utilities/lambdify.py',
    'sympy/utilities/tests/test_lambdify.py',
]

print('Testing optional dependencies')

import sympy
if not (sympy.test(*test_list, verbose=True) and sympy.doctest(*doctest_list)):
    raise TestsFailedError('Tests failed')
Exemplo n.º 11
0
 def run(self):
     if sympy.test():
         # all regular tests run successfuly, so let's also run doctests
         # (if some regular test fails, the doctests are not run)
         sympy.doctest()
Exemplo n.º 12
0
    # matchpy
    '*rubi*',

    # codegen
    'sympy/codegen/',

    # pycosat
    'sympy/logic',
    'sympy/assumptions',

    #stats
    'sympy/stats',
]

if not (sympy.test(*test_list, blacklist=blacklist)
        and sympy.doctest(*doctest_list)):
    raise TestsFailedError('Tests failed')

print('Testing MATPLOTLIB')
# Set matplotlib so that it works correctly in headless Travis. We have to do
# this here because it doesn't work after the sympy plotting module is
# imported.
import matplotlib
matplotlib.use("Agg")
import sympy
# Unfortunately, we have to use subprocess=False so that the above will be
# applied, so no hash randomization here.
if not (sympy.test('sympy/plotting',
                   'sympy/physics/quantum/tests/test_circuitplot.py',
                   subprocess=False)
Exemplo n.º 13
0
with and without symengine.

Run this as:

    $ USE_SYMENGINE=1 bin/test_symengine.py
"""

# Add the local sympy to sys.path (needed for CI)
from get_sympy import path_hack
path_hack()


class TestsFailedError(Exception):
    pass


test_list = [
    'sympy/physics/mechanics',
    'sympy/liealgebras',
]

print('Testing optional dependencies')

#
# XXX: The doctests are not tested here but there are many failures when
# running them with symengine.
#
import sympy
if not sympy.test(*test_list, verbose=True):
    raise TestsFailedError('Tests failed')
Exemplo n.º 14
0
 def run(self):
     sympy.test()
     tdoc = test_sympy_doc(self.args)
     tdoc.run()  # run also the doc test suite
Exemplo n.º 15
0
 def run(self):
     sympy.test()
     tdoc = test_sympy_doc(self.args)
     tdoc.run() # run also the doc test suite
Exemplo n.º 16
0
import os
TEST_SYMPY = os.getenv('TEST_SYMPY', False)

import symengine
if not symengine.test():
    raise Exception('Tests failed')

if TEST_SYMPY:
    import sympy
    from sympy.core.cache import clear_cache
    import atexit

    atexit.register(clear_cache)
    print('Testing SYMPY')
    if not sympy.test('sympy/physics/mechanics'):
        raise Exception('Tests failed')
    if not sympy.test('sympy/liealgebras'):
        raise Exception('Tests failed')
Exemplo n.º 17
0
"""
Disclaimer
==========

This software was developed at the National Institute of Standards and Technology at the NIST Center for Neutron Research by employees of the Federal Government in the course of their official duties. Pursuant to title 17 section 105* of the United States Code this software is not subject to copyright protection and is in the public domain. The SPINAL software package is an experimental spinwave analysis system. NIST assumes no responsibility whatsoever for its use, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic. The use of certain trade names or commercial products does not imply any endorsement of a particular product, nor does it imply that the named product is necessarily the best product for the stated purpose. We would appreciate acknowledgment if the software is used.

*Subject matter of copyright: United States Government works

Copyright protection under this title is not available for any work of the United States Government, but the United States Government is not precluded from receiving and holding copyrights transferred to it by assignment, bequest, or otherwise."""


import sympy
sympy.test()
Exemplo n.º 18
0
    # matchpy
    '*rubi*',

    # codegen
    'sympy/codegen/',

    # pycosat
    'sympy/logic',
    'sympy/assumptions',

    #stats
    'sympy/stats',

]

if not (sympy.test(*test_list, verbose=True, blacklist=blacklist) and sympy.doctest(*doctest_list)):
    raise TestsFailedError('Tests failed')


print('Testing MATPLOTLIB')
# Set matplotlib so that it works correctly in headless Travis. We have to do
# this here because it doesn't work after the sympy plotting module is
# imported.
import matplotlib
matplotlib.use("Agg")
import sympy
# Unfortunately, we have to use subprocess=False so that the above will be
# applied, so no hash randomization here.
if not (sympy.test('sympy/plotting', 'sympy/physics/quantum/tests/test_circuitplot.py',
    subprocess=False) and sympy.doctest('sympy/plotting', subprocess=False)):
    raise TestsFailedError('Tests failed')