コード例 #1
0
def runtestsleak(repeats, *args, **kargs):
    import gc
    test = r1 = r2 = None
    while repeats:
        repeats -= 1
        gc.collect()
        r1 = sys.gettotalrefcount()
        for test in alltests:
            mpiunittest.main(test, *args, **kargs)
        gc.collect()
        r2 = sys.gettotalrefcount()
        sys.stderr.flush()
        sys.stderr.write('\nREF LEAKS -- before: %d, after: %d, diff: [%d]\n' % (r1, r2, r2-r1))
        sys.stderr.flush()
コード例 #2
0
ファイル: test_p2p_buf.py プロジェクト: whu-dft/mpi4py
            comm.Free()


class TestP2PBufSelf(BaseTestP2PBuf, unittest.TestCase):
    COMM = MPI.COMM_SELF


class TestP2PBufWorld(BaseTestP2PBuf, unittest.TestCase):
    COMM = MPI.COMM_WORLD


class TestP2PBufSelfDup(TestP2PBufSelf):
    def setUp(self):
        self.COMM = MPI.COMM_SELF.Dup()

    def tearDown(self):
        self.COMM.Free()


@unittest.skipMPI('openmpi(<1.4.0)', MPI.Query_thread() > MPI.THREAD_SINGLE)
class TestP2PBufWorldDup(TestP2PBufWorld):
    def setUp(self):
        self.COMM = MPI.COMM_WORLD.Dup()

    def tearDown(self):
        self.COMM.Free()


if __name__ == '__main__':
    unittest.main()
コード例 #3
0
ファイル: test_pickle.py プロジェクト: benkirk/mpi_playground
            self.do_pickle(obj, pickle)
        self.do_pickle(OBJS2, pickle)

    @unittest.skipIf(json is None, 'json')
    def testJson(self):
        pickle = self.pickle
        dumps = lambda o: json.dumps(o).encode()
        loads = lambda s: json.loads(tobytes(s).decode())
        pickle.__init__(dumps, loads)
        OBJS2 = [o for o in OBJS
                 if not isinstance(o, (float, complex, tuple))]
        for obj in OBJS2:
            self.do_pickle(obj, pickle)
        self.do_pickle(OBJS2, pickle)

    @unittest.skipIf(yaml is None, 'yaml')
    def testYAML(self):
        pickle = self.pickle
        dumps = lambda o: yaml.dump(o).encode()
        loads = lambda s: yaml.load(tobytes(s).decode())
        pickle.__init__(dumps, loads)
        OBJS2 = [o for o in OBJS
                 if not isinstance(o, (complex, tuple))]
        for obj in OBJS2:
            self.do_pickle(obj, pickle)
        self.do_pickle(OBJS2, pickle)


if __name__ == '__main__':
    unittest.main()
コード例 #4
0
def runtests(*args, **kargs):
    for test in alltests:
        sys.stderr.flush()
        sys.stderr.write("\nRunning %s\n" % test.__name__)
        sys.stderr.flush()
        mpiunittest.main(test, *args, **kargs)