def test_no_change(self, sub_script_path_cpt):
     orig_lines = open(sub_script_path_cpt, 'r').readlines()
     from paratemp.sim_setup.para_temp_setup import \
         _add_cpt_to_sub_script as acpt
     acpt(sub_script_path_cpt, 'checkpoint_test')
     new_lines = open(sub_script_path_cpt, 'r').readlines()
     for line in new_lines:
         if 'mpirun' in line:
             md_line = line
             break
     else:
         raise ValueError('Could not find "mpirun" line')
     assert 'checkpoint_test' not in md_line
     assert not len(set(new_lines) - set(orig_lines))
 def test_comment_line(self, sub_script_path):
     orig_lines = open(sub_script_path, 'r').readlines()
     from paratemp.sim_setup.para_temp_setup import \
         _add_cpt_to_sub_script as acpt
     acpt(sub_script_path, 'checkpoint_test')
     new_lines = open(sub_script_path, 'r').readlines()
     for line in new_lines:
         if 'comment' in line:
             new_comm_line = line
             break
     else:
         raise ValueError('Could not find "comment" line')
     for line in orig_lines:
         if 'comment' in line:
             orig_comm_line = line
             break
     else:
         raise ValueError('Could not find "comment" line')
     assert orig_comm_line == new_comm_line
 def test_raises_value_error(self, tmpdir):
     from paratemp.sim_setup.para_temp_setup import \
         _add_cpt_to_sub_script as acpt
     test_sub = tmpdir.join('test.sub').ensure()
     with pytest.raises(ValueError, match='Could not find GROMACS mdrun'):
         acpt(str(test_sub), 'checkpoint_test')