def test_prepare_module_name(capsys): """Test that prepare_module_name works as expected.""" # Fail state with pytest.raises(SystemExit) as e: prepare_module_name("gromacs-2016.4") assert e.type == SystemExit assert e.code == 1 out, err = capsys.readouterr() assert out == "ERROR We were not able to determine the module name.\n" # Second fail state with pytest.raises(SystemExit) as e: prepare_module_name("whatever", skip_validation=True) assert e.type == SystemExit assert e.code == 1 out, err = capsys.readouterr() assert ( out == "ERROR Although you are using the --skip-validation option, you have to " "provide a valid MD engine name, e.g., gromacs/dummy or namd/dummy.\n") assert prepare_module_name("gromacs/2016.4")
def test_correct_module_name(): prepare_module_name('gromacs/2016.4')
def test_wrong_module_name(): prepare_module_name('gromacs-2016.4')