def test_fail_existing_path(mocker): mocker.patch("os.path.exists", return_value=False) with pytest.raises(argparse.ArgumentTypeError, match="No path called"): parser.existing_path("any")
def test_existing_path(mocker): mocker.patch("os.path.exists", return_value=True) assert os.path.abspath("any") == parser.existing_path("any")