Example #1
0
 def test_launch_user_json(self, capsys):
     """Test launch with JSON topology file."""
     args = self.args.copy()
     args["lipid_jsons"] = [str(PATH_ROOT_DATA / "Berger_POPC.json")]
     UI.launch(**args)
     captured = capsys.readouterr().out
     assert "Results written to OP_buildH.out" in captured
Example #2
0
 def test_fails_launch_lipidtype(self, capsys):
     """Fail tests when passing a wrong lipid type."""
     args = self.args.copy()
     args["lipid_type"] = "PPHA"
     with pytest.raises(BuildHError) as err:
         UI.launch(**args)
     assert err.type == BuildHError
     assert "Lipid PPHA is not supported" in str(err.value)
Example #3
0
 def test_fail_launch_file(self):
     """Test fail launch with a non existant file."""
     args = self.args.copy()
     # Pass a string instead of a list
     args["traj_file"] = "nofile.xtc"
     with pytest.raises(FileNotFoundError) as err:
         UI.launch(**args)
     assert "nofile.xtc does not exist." in str(err.value)
Example #4
0
 def test_fail_launch_json(self):
     """Test fail launch with a wrong argument for JSON topology file."""
     args = self.args.copy()
     # Pass a string instead of a list
     args["lipid_jsons"] = str(PATH_ROOT_DATA / "Berger_POPC.json")
     with pytest.raises(TypeError) as err:
         UI.launch(**args)
     assert "a list is expected for argument 'lipid_jsons'" in str(
         err.value)
Example #5
0
 def test_launch_traj(self, capsys):
     """Test launch with all trajectory arguments."""
     args = self.args.copy()
     args["traj_file"] = str(PATH_DATA / "2POPC.xtc")
     args["out_file"] = "out.txt"
     args["prefix_traj_ouput"] = "basename"
     args["begin"] = 0
     args["end"] = 10000
     UI.launch(**args)
     captured = capsys.readouterr().out
     assert "Results written to out.txt" in captured
     assert "Dealing with frame 10 at 10000.0 ps." in captured
     assert "Writing new pdb with hydrogens." in captured
     assert "Writing trajectory with hydrogens in xtc file." in captured
Example #6
0
 def test_launch_minimal(self, capsys):
     """Test launch with minimal arguments."""
     UI.launch(**self.args)
     captured = capsys.readouterr().out
     assert "Results written to OP_buildH.out" in captured