Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_existing_symlink_points_to_nothing(pipx_temp_env, caplog, capsys):
constants.LOCAL_BIN_DIR.mkdir(exist_ok=True, parents=True)
(constants.LOCAL_BIN_DIR / "pycowsay").symlink_to("/asdf/jkl")
assert not run_pipx_cli(["install", "pycowsay"])
captured = capsys.readouterr()
# pipx should realize the symlink points to nothing and replace it,
# so no warning should be present
assert "symlink missing or pointing to unexpected location" not in captured.out