Esempio n. 1
0
 def test_runwithpermutation(self):
     self.addFileToRemove('imageset.txt', preemptive=True)
     with open('imageset.txt', 'w') as fp:
         fp.writelines([
             filename + os.linesep
             for filename in os.listdir(self.locateFile('tests/images'))
             if not filename.startswith('test_project')
         ])
     if os.path.exists('test_projects'):
         shutil.rmtree('test_projects')
     os.mkdir('test_projects')
     batch_project.loadCustomFunctions()
     batchProject = batch_project.loadJSONGraph(
         self.locateFile(
             'tests/specifications/permutation_batch_process.json'))
     global_state = {
         'projects': 'test_projects',
         'project': batchProject,
         'picklists_files': {},
         'image_dir': self.locateFile('tests/images'),
         'count': batch_project.IntObject(20),
         'permutegroupsmanager': PermuteGroupManager()
     }
     batchProject.loadPermuteGroups(global_state)
     for i in range(100):
         batchProject.executeOnce(global_state)
     self.assertTrue(global_state['permutegroupsmanager'].hasNext())
Esempio n. 2
0
 def test_run(self):
     self.general_setup()
     batchProject = batch_project.loadJSONGraph(
         self.locateFile('tests/specifications/batch_process.json'))
     global_state = {
         'projects': 'test_projects',
         'project': batchProject,
         'picklists_files': {},
         'workdir': '.',
         'image_dir': self.locateFile('tests/images'),
         'count': batch_project.IntObject(20),
         'permutegroupsmanager': PermuteGroupManager(),
         'donorImages': self.locateFile('tests/images')
     }
     batchProject.loadPermuteGroups(global_state)
     for i in range(2):
         batchProject.executeOnce(global_state)
     try:
         #self.assertFalse(global_state['permutegroupsmanager'].hasNext())
         global_state['permutegroupsmanager'].next()
         self.assertTrue(global_state['permutegroupsmanager'].hasNext())
         global_state['permutegroupsmanager'].next()
         self.fail('Should have seen an end of resource exception')
     except EndOfResource:
         pass
Esempio n. 3
0
 def test_run(self):
     if os.path.exists('test_coco_projects'):
         shutil.rmtree('test_coco_projects')
     os.mkdir('test_coco_projects')
     batch_project.loadCustomFunctions()
     batchProject = batch_project.loadJSONGraph(
         'tests/other_plugins/CocoMaskSelector/batch_process.json')
     global_state = {
         'projects': 'test_coco_projects',
         'project': batchProject,
         'picklists_files': {},
         'workdir': '.',
         'coco.annotations':
         'tests/other_plugins/CocoMaskSelector/annotations.json',
         'count': batch_project.IntObject(20),
         'permutegroupsmanager': PermuteGroupManager()
     }
     global_state.update(createBatchProjectGlobalState(global_state))
     batchProject.loadPermuteGroups(global_state)
     batchProject.executeOnce(global_state)
 def test_runwithpermutation(self):
     batch_project.loadCustomFunctions()
     d = tempfile.mkdtemp(prefix='external_image', dir='.')
     self.general_setup(d)
     os.mkdir(os.path.join(d, 'test_projects'))
     batch_project.loadCustomFunctions()
     batchProject = batch_project.loadJSONGraph(
         self.locateFile('tests/specifications/permutation_batch_process.json'))
     global_state = {
         'projects': os.path.join(d, 'test_projects'),
         'project': batchProject,
         'workdir': d,
         'picklists_files': {},
         'image_dir': self.locateFile('tests/images'),
         'count': batch_project.IntObject(20),
         'permutegroupsmanager': PermuteGroupManager(d)
     }
     batchProject.loadPermuteGroups(global_state)
     for i in range(10):
         batchProject.executeOnce(global_state)
     self.assertTrue(global_state['permutegroupsmanager'].hasNext())