def setUp(self): TestCase.setUp(self) self.outputdir = tempfile.mkdtemp() self.workdir = tempfile.mkdtemp() ops = Options('test') ops.detectors['traj'] = TrajectoryDetector(False) ops.limits.add(ShowersLimit(1)) self.ops = Converter().convert(ops)[0] self.worker = Worker(program)
class TestWorker(TestCase): def setUp(self): TestCase.setUp(self) self.outputdir = tempfile.mkdtemp() self.workdir = tempfile.mkdtemp() ops = Options('test') ops.detectors['traj'] = TrajectoryDetector(False) ops.limits.add(ShowersLimit(1)) self.ops = Converter().convert(ops)[0] self.worker = Worker(program) def tearDown(self): TestCase.tearDown(self) shutil.rmtree(self.outputdir, ignore_errors=True) shutil.rmtree(self.workdir, ignore_errors=True) def testrun(self): results = self.worker.run(self.ops, self.outputdir, self.workdir) self.assertIn('traj', results[0])