Example #1
0
 def test_restart_info(self):
     ri = abinit_tasks.RestartInfo("/path/to/dir",
                                   reset=False,
                                   num_restarts=4)
     self.assertMSONable(ri)
     ri.prev_indir
     ri.prev_outdir
Example #2
0
    def test_scf_unconverged(self, report):
        scf_task = abinit_tasks.ScfFWTask(self.si_scf_input)
        ftm_path = os.path.join(test_dir, "fw_manager_ok.yaml")
        scf_task.ftm = abiflows.fireworks.utils.fw_utils.FWTaskManager.from_file(ftm_path)

        report.return_value = mock_objects.report_ScfConvergenceWarning()

        with mock.patch.object(abinit_tasks.AbiFireTask, 'prepare_restart',
                               return_value=(False, mock_objects.fake_fw, {})) as pr:
            fake_spec = {'test': 1}
            action = scf_task.task_analysis(fake_spec)
            pr.assert_called_once_with(fake_spec)
            self.assertIsInstance(action, FWAction)

            scf_task.restart_info = abinit_tasks.RestartInfo(
                previous_dir='.', num_restarts=scf_task.ftm.fw_policy.max_restarts)
            with self.assertRaises(abinit_tasks.UnconvergedError):
                scf_task.task_analysis(fake_spec)