Beispiel #1
0
#!/usr/bin/env python
"""Test the bpod module"""

import unittest
import copy
import os
from os.path import join
from shutil import rmtree
import numpy as N

import helper
helper.add_to_path(
    join(join(os.path.dirname(os.path.abspath(__file__)), '..', 'src')))
import parallel as parallel_mod
_parallel = parallel_mod.parallel_default_instance

from bpod import *
from vectorspace import *
import util
import vectors as V


@unittest.skipIf(_parallel.is_distributed(), 'Serial only.')
@unittest.skip('Testing others')
class TestBPODMatrices(unittest.TestCase):
    def setUp(self):
        self.mode_indices = [2, 4, 6, 3]
        self.num_direct_vecs = 10
        self.num_adjoint_vecs = 12
        self.num_states = 15
        num_inputs = 1
Beispiel #2
0
""" This module collects all of the tests and runs them"""

import os
import unittest

import helper
helper.add_to_path('src')
#import parallel as parallel_mod
#parallel = parallel_mod.parallel_default_instance

# Check if we have discover function, if not use unittest2 
# This might be compatible with some python versions < 2.7
"""
try:
    dummy = unittest.defaultTestLoader.discover(os.path.dirname(__file__))
except:
    import unittest2 as unittest
"""

def run():
    test_loader = unittest.defaultTestLoader
    #print 'discovering tests in path',os.path.dirname(__file__)
    test_suites = test_loader.discover(os.path.dirname(__file__))
        #, top_level_dir='../')
    unittest.TextTestRunner(buffer=True).run(test_suites)
    #parallel.barrier()

if __name__ == '__main__':
    run()
Beispiel #3
0
#!/usr/bin/env python
""" !!This file is not used!!

Examples are used with ../examples/Makefile."""

import unittest
import os, sys
from os.path import join
from shutil import rmtree
import helper
helper.add_to_path(join(join(os.path.dirname(os.path.abspath(__file__)), 
    '..', 'examples')))
helper.add_to_path(join(join(os.path.dirname(os.path.abspath(__file__)), 
    '..', 'src')))
import parallel as parallel_mod
_parallel = parallel_mod.parallel_default_instance

# Directory we start from, absolute path.
running_dir = os.getcwd()
# Directory of this test file, abs path.
this_file_dir = os.path.dirname(os.path.abspath(__file__))
# Directory containing example files, abs path.
examples_dir = join(join(this_file_dir, '..'), 'examples')

"""
# Redefine stdout and stderr to suppress output from the examples in the tests.
class NoPrintingStream(object):
    def write(self,data): pass
    #def read(self,data): pass
    def flush(self): pass
    def close(self): pass
Beispiel #4
0
""" This module collects all of the tests and runs them"""

import os
import unittest

import helper
helper.add_to_path('src')
#import parallel as parallel_mod
#parallel = parallel_mod.parallel_default_instance

# Check if we have discover function, if not use unittest2
# This might be compatible with some python versions < 2.7
"""
try:
    dummy = unittest.defaultTestLoader.discover(os.path.dirname(__file__))
except:
    import unittest2 as unittest
"""


def run():
    test_loader = unittest.defaultTestLoader
    #print 'discovering tests in path',os.path.dirname(__file__)
    test_suites = test_loader.discover(os.path.dirname(__file__))
    #, top_level_dir='../')
    unittest.TextTestRunner(buffer=True).run(test_suites)
    #parallel.barrier()


if __name__ == '__main__':
    run()