def test_CLI_user_json(self, capsys): """Test working CLI with JSON topology file.""" sys.argv = (self.common_args + ["-l", "Berger_POPC"] + ["-lt", str(PATH_ROOT_DATA / "Berger_POPC.json")]) UI.entry_point() captured = capsys.readouterr().out assert "Results written to OP_buildH.out" in captured
def test_fails_CLI_lipidtype(self, capsys): """Fail tests when passing a wrong lipid type.""" sys.argv = self.common_args + ["-l", "PPHA"] with pytest.raises(SystemExit) as err: UI.entry_point() # Make sur the exception is thrown assert err.type == SystemExit assert "Lipid PPHA is not supported" in capsys.readouterr().err
def test_fails_CLI_slice(self, capsys): """Fail tests when passing a slice option without a trajectory.""" sys.argv = sys.argv = self.common_args + [ "-l", "Berger_POPC", "-e", "1000" ] with pytest.raises(SystemExit) as err: UI.entry_point() assert err.type == SystemExit assert "Slicing is only possible with a trajectory file." in capsys.readouterr( ).err
def test_CLI_traj(self, capsys): """Test working CLI with all trajectory arguments.""" sys.argv = (self.common_args + ["-t", str(PATH_DATA / "2POPC.xtc")] + ["-l", "Berger_POPC"] + ["-o", "out.txt"] + ["-opx", "base"] + ["-b", "1000", "-e", "10000"]) UI.entry_point() 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
def test_CLI_minimal(self, capsys): """Test working CLI with minimal arguments.""" sys.argv = self.common_args + ["-l", "Berger_POPC"] UI.entry_point() captured = capsys.readouterr().out assert "Results written to OP_buildH.out" in captured