Commit d8c05c37 by Randy Döring

fix(cache clear): normalize package name

parent 20352b61
......@@ -4,6 +4,7 @@ import os
from cleo.helpers import argument
from cleo.helpers import option
from packaging.utils import canonicalize_name
from poetry.config.config import Config
from poetry.console.commands.command import Command
......@@ -66,7 +67,7 @@ class CacheClearCommand(Command):
"Add a specific version to clear"
)
elif len(parts) == 3:
package = parts[1]
package = canonicalize_name(parts[1])
version = parts[2]
if not cache.has(f"{package}:{version}"):
......
......@@ -55,12 +55,16 @@ def test_cache_clear_all_no(
assert cache.has("cleo:0.2")
@pytest.mark.parametrize("package_name", ["cachy", "Cachy"])
def test_cache_clear_pkg(
tester: ApplicationTester,
repository_one: str,
cache: CacheManager,
package_name: str,
):
exit_code = tester.execute(f"cache clear {repository_one}:cachy:0.1", inputs="yes")
exit_code = tester.execute(
f"cache clear {repository_one}:{package_name}:0.1", inputs="yes"
)
assert exit_code == 0
assert tester.io.fetch_output() == ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment