Ejemplo n.º 1
0
def test(folder=None, remove=True, predicate=None):
    """Runs all pypet tests

    :param folder:

        Temporary folder to put data in, leave `None` for
        automatic choice.

    :param remove:

        If temporary data should be removed after the tests.

    :param predicate:

        Predicate to specify subset of tests. Must take three arguments
        ``class_name``, ``test_name``, ``tags`` and evaluate to `True` if
        a test should be run. Leave `None` for all tests.


    """
    if predicate is None:
        predicate = lambda class_name, test_name, tags: class_name != TEST_IMPORT_ERROR
    suite = discover_tests(predicate=predicate)
    run_suite(suite=suite, remove=remove, folder=folder)
Ejemplo n.º 2
0
def test(folder=None, remove=True, predicate=None):
    """Runs all pypet tests

    :param folder:

        Temporary folder to put data in, leave `None` for
        automatic choice.

    :param remove:

        If temporary data should be removed after the tests.

    :param predicate:

        Predicate to specify subset of tests. Must take three arguments
        ``class_name``, ``test_name``, ``tags`` and evaluate to `True` if
        a test should be run. Leave `None` for all tests.


    """
    if predicate is None:
        predicate = lambda class_name, test_name, tags: class_name != TEST_IMPORT_ERROR
    suite = discover_tests(predicate=predicate)
    run_suite(suite=suite, remove=remove, folder=folder)
Ejemplo n.º 3
0
__author__ = 'Robert Meyer'


from pypet.tests.testutils.ioutils import run_suite, TEST_IMPORT_ERROR, discover_tests, \
    parse_args

unit_pred = lambda class_name, test_name, tags: ('unittest' in tags and
                                                 'multiproc' not in tags)
unit_suite = discover_tests(unit_pred)

exclude_set = set(('hdf5_settings', 'multiproc', 'merge'))
integration_pred = lambda class_name, test_name, tags: (
    'integration' in tags and not bool(exclude_set & tags))
integration_suite = discover_tests(integration_pred)

include_set = set(('hdf5_settings', 'links', 'merge'))
integration_pred_2 = lambda class_name, test_name, tags: (
    'integration' in tags and bool(include_set & tags) and 'multiproc' not in
    tags and 'links' not in tags)
integration_suite_2 = discover_tests(integration_pred_2)

suite_dict = {
    '1': unit_suite,
    '2': integration_suite,
    '3': integration_suite_2
}

if __name__ == '__main__':
    opt_dict = parse_args()
    suite = None
    if 'suite_no' in opt_dict:
Ejemplo n.º 4
0
__author__ = 'robert'

try:
    import pypet
except ImportError:
    import sys
    sys.path.append('/media/data/PYTHON_WORKSPACE/pypet-project')

import scoop

from pypet.tests.testutils.ioutils import discover_tests, parse_args, run_suite
from pypet.tests.integration.environment_scoop_test import check_mock

scoop_suite = discover_tests(lambda  class_name, test_name, tags: 'scoop' in tags)


if __name__ == '__main__':
    mock = check_mock()
    if mock:
        raise RuntimeError('Not running in SCOOP mode!')
    opt_dict = parse_args()
    run_suite(suite=scoop_suite, **opt_dict)
Ejemplo n.º 5
0
__author__ = 'Robert Meyer'

import getopt
import sys
import os
import sys
if (sys.version_info < (2, 7, 0)):
    import unittest2 as unittest
else:
    import unittest

from pypet.tests.testutils.ioutils import discover_tests, TEST_IMPORT_ERROR

class NoseTestDummy(unittest.TestCase):
    pass

suite = discover_tests(predicate= lambda class_name, test_name, tags:
                                                class_name != TEST_IMPORT_ERROR)
suite_dict = {}
for case in suite:
    class_name = case.__class__.__name__
    globals()[class_name] = case.__class__

Ejemplo n.º 6
0
                    cov.save()
        return Process_WithCoverage

ProcessCoverage = coverage_multiprocessing_process()
if ProcessCoverage:
    multiprocessing.Process = ProcessCoverage
    print('Added Monkey-Patch for multiprocessing and code-coverage')


import sys
import os

pypetpath=os.path.abspath(os.getcwd())
sys.path.append(pypetpath)
print('Appended path `%s`' % pypetpath)

from pypet.tests.testutils.ioutils import run_suite, discover_tests, TEST_IMPORT_ERROR, parse_args


if __name__ == '__main__':
    opt_dict = parse_args()
    tests_include = set(('TestMPImmediatePostProc',
                    'MultiprocFrozenPoolSortQueueTest',
                    'MultiprocLinkNoPoolLockTest',
                    'MultiprocLinkNoPoolQueueTest',
                    'MultiprocLinkQueueTest',
                    'CapTest'))
    pred = lambda class_name, test_name, tags: (class_name in tests_include or
                                                 'multiproc' not in tags)
    suite = discover_tests(pred)
    run_suite(suite=suite, **opt_dict)
Ejemplo n.º 7
0
tests_include=set(('MultiprocNoPoolLockTest',
                   #'MultiprocNoPoolPipeTest',
                   'MultiprocPoolSortQueueTest',
                   'MultiprocFrozenPoolSortQueueTest',
                   'MultiprocLinkLockTest',
                   'CapTest',
                   # 'MultiprocPoolLockTest',
                   'MultiprocStorageLockTest',
                   'MultiprocNoPoolQueueLoggingTest',
                   'MultiprocFrozenPoolLocalTest',
                   'TestMPImmediatePostProcQueue',
                   'MultiprocNoPoolNetlockTest',
                   'MultiprocStorageNetlockTest',
                   'MultiprocSCOOPLocalTest'))
big_suite_1 = discover_tests(lambda  class_name, test_name, tags: class_name in tests_include)

tests_include=set((#'MultiprocNoPoolQueueTest',
                   'MultiprocPoolQueueTest',
                   'MultiprocFrozenPoolPipeTest',
                   'MultiprocPoolSortLockTest',
                   'MultiprocPoolSortPipeTest',
                   'MultiprocFrozenPoolSortLockTest',
                   'MultiprocLinkNoPoolLockTest',
                   'TestMPPostProc',
                   'ContinueMPPoolTest',
                   'MultiprocPoolLockLoggingTest',
                   'MultiprocNoPoolSortLocalTest',
                   'TestMPImmediatePostProcLocal',
                   'MultiprocPoolSortNetlockTest',
                   'MultiprocSCOOPSortLocalTest'))
Ejemplo n.º 8
0
tests_include = set((
    'MultiprocNoPoolLockTest',
    #'MultiprocNoPoolPipeTest',
    'MultiprocPoolSortQueueTest',
    'MultiprocFrozenPoolSortQueueTest',
    'MultiprocLinkLockTest',
    'CapTest',
    # 'MultiprocPoolLockTest',
    'MultiprocStorageLockTest',
    'MultiprocNoPoolQueueLoggingTest',
    'MultiprocFrozenPoolLocalTest',
    'TestMPImmediatePostProcQueue',
    'MultiprocStorageNetlockTest',
    'MultiprocSCOOPSortNetqueueTest'))

big_suite_1 = discover_tests(
    lambda class_name, test_name, tags: class_name in tests_include)

tests_include = set((  #'MultiprocNoPoolQueueTest',
    'MultiprocPoolQueueTest', 'MultiprocFrozenPoolPipeTest',
    'MultiprocPoolSortLockTest', 'MultiprocPoolSortPipeTest',
    'MultiprocFrozenPoolSortLockTest', 'MultiprocLinkNoPoolLockTest',
    'TestMPPostProc', 'ContinueMPPoolTest', 'MultiprocPoolLockLoggingTest',
    'MultiprocNoPoolSortLocalTest', 'TestMPImmediatePostProcLocal',
    'MultiprocSCOOPSortLocalTest', 'MultiprocFrozenSCOOPLocalTest'))
big_suite_2 = discover_tests(
    lambda class_name, test_name, tags: class_name in tests_include)

tests_include = set((  #'MultiprocFrozenPoolLockTest',
    'MultiprocNoPoolSortQueueTest',
    'MultiprocLinkNoPoolQueueTest',
    'MultiprocPoolSortPipeTest',
Ejemplo n.º 9
0
__author__ = 'Robert Meyer'

import getopt
import sys
import os
import sys
if (sys.version_info < (2, 7, 0)):
    import unittest2 as unittest
else:
    import unittest

from pypet.tests.testutils.ioutils import discover_tests, TEST_IMPORT_ERROR


class NoseTestDummy(unittest.TestCase):
    pass


suite = discover_tests(predicate=lambda class_name, test_name, tags: class_name
                       != TEST_IMPORT_ERROR)
suite_dict = {}
for case in suite:
    class_name = case.__class__.__name__
    globals()[class_name] = case.__class__
Ejemplo n.º 10
0
    multiprocessing.Process = ProcessCoverage
    print('Added Monkey-Patch for multiprocessing and code-coverage')


import sys
import os

pypetpath=os.path.abspath(os.getcwd())
sys.path.append(pypetpath)
print('Appended path `%s`' % pypetpath)

from pypet.tests.testutils.ioutils import run_suite, discover_tests, TEST_IMPORT_ERROR, parse_args


if __name__ == '__main__':
    opt_dict = parse_args()
    tests_include = set(('TestMPImmediatePostProcLock',
                    'MultiprocFrozenPoolSortQueueTest',
                    'MultiprocFrozenPoolSortPipeTest',
                    'MultiprocLinkNoPoolLockTest',
                    'MultiprocLinkNoPoolQueueTest',
                    'MultiprocLinkQueueTest',
                    'MultiprocPoolSortLocalTest',
                    'MultiprocSCOOPSortLocalTest',
                    'MultiprocFrozenSCOOPSortNetlockTest',
                    'MultiprocFrozenSCOOPSortNetqueueTest',
                    'CapTest'))
    pred = lambda class_name, test_name, tags: (class_name in tests_include or
                                                 'multiproc' not in tags)
    suite = discover_tests(pred)
    run_suite(suite=suite, **opt_dict)
Ejemplo n.º 11
0
__author__ = 'Robert Meyer'


from pypet.tests.testutils.ioutils import run_suite, TEST_IMPORT_ERROR, discover_tests, \
    parse_args

unit_pred = lambda class_name, test_name, tags: ('unittest' in tags and
                                                 'multiproc' not in tags)
unit_suite = discover_tests(unit_pred)

exclude_set = set(('hdf5_settings', 'multiproc', 'merge'))
integration_pred = lambda class_name, test_name, tags: ('integration' in tags and
                                                         not bool(exclude_set & tags))
integration_suite = discover_tests(integration_pred)

include_set = set(('hdf5_settings', 'links', 'merge'))
integration_pred_2 = lambda class_name, test_name, tags: ('integration' in tags and
                                                          bool(include_set & tags) and
                                                          'multiproc' not in tags and
                                                          'links' not in tags)
integration_suite_2 = discover_tests(integration_pred_2)

suite_dict = {'1': unit_suite, '2': integration_suite, '3': integration_suite_2}


if __name__ == '__main__':
    opt_dict = parse_args()
    suite = None
    if 'suite_no' in opt_dict:
        suite_no = opt_dict.pop('suite_no')
        suite = suite_dict[suite_no]