def test_export_image(self): shared_file = SharedFile(self.test_file, self.frame_path) self.output_file_name = os.path.join( iutils_testing.data_dir, 'output.avi') video.export(shared_file, output=self.output_file_name) shared_file.close() self.assertTrue(os.path.exists(self.output_file_name))
def test_export_profile(self): shared_file = SharedFile(self.test_file) self.assertFalse(os.path.exists(self.output_file_name)) r=video.export( shared_file, self.profile_path, output=self.output_file_name) shared_file.close() self.assertTrue(r) self.assertTrue(os.path.exists(self.output_file_name))
def test_gui(self): shared_file = SharedFile(self.test_file) video_exporter = video.VideoExporter(shared_file) video_exporter.show() QtGui.qApp.exec_() shared_file.close()
class TestRefUpdater(unittest.TestCase): def setUp(self): self.zerotime = time() self.k = os.path.join(dspath, 'refup', 'h', 'self') if os.path.exists(self.k): os.remove(self.k) self.sh = SharedFile('reftest.h5', mode='w') self.ru = refupdater.ReferenceUpdater(dspath, self.sh, self.zerotime) self.ds = dirshelf.DirShelf(dspath, 'refup', { 'h': Option(handle='h', type='Integer', attr=['History'], kid='/h') }) def tearDown(self): self.sh.close() self.ru.close() self.ds.close() @unittest.skip('Maybe not needed') def test_dump(self): dumps(self.ru) def changeval(self, nval): print 'CHANGEVAL', nval t0 = time() sleep(0.1) t1 = time() self.ds.set_current('h', nval, t1) sleep(0.1) t2 = time() self.assertTrue(self.ru.sync()) rt = self.ru.cache[self.k].mtime print '{:f} < {:f} < {:f}'.format(t0, rt, t2) self.assertEqual(rt, t1) self.assertGreater(rt, t0) self.assertLess(rt, t2) def test_refupdater(self): # FIXME: The reference is created but the first point is missed self.ru.nthreads = 1 self.ru.sync() print self.ru.cache self.assertTrue(self.ru.cache.has_key(self.k)) rt = self.ru.cache[self.k].mtime self.assertAlmostEqual(rt, self.zerotime, delta=0.1) self.changeval(1) # Check double appending for i in range(10): print 'Changing values', i self.changeval(i + 2) sleep(5) for i in range(10): print 'Sync', i self.ru.sync() # Check summary for i in range(10): print 'Changing values', i self.changeval(i + 2) sleep(1)