Skip to content

Commit 2d3f17c

Browse files
author
Noah Gorny
committed
tests: cache: Add no files to remove cases
1 parent 2c04ed7 commit 2d3f17c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/functional/test_cache.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,24 @@ def test_cache_list_with_empty_cache_abspath(script):
244244
assert result.stdout.strip() == ""
245245

246246

247+
@pytest.mark.usefixtures("empty_wheel_cache")
248+
def test_cache_purge_with_empty_cache(script):
249+
"""Running `pip cache purge` with an empty cache should print a warning
250+
and exit without an error code."""
251+
result = script.pip("cache", "purge", allow_stderr_warning=True)
252+
assert result.stderr == "WARNING: No matching packages\n"
253+
assert result.stdout == "Files removed: 0\n"
254+
255+
256+
@pytest.mark.usefixtures("populate_wheel_cache")
257+
def test_cache_remove_with_bad_pattern(script):
258+
"""Running `pip cache remove` with a bad pattern should print a warning
259+
and exit without an error code."""
260+
result = script.pip("cache", "remove", "aaa", allow_stderr_warning=True)
261+
assert result.stderr == 'WARNING: No matching packages for pattern "aaa"\n'
262+
assert result.stdout == "Files removed: 0\n"
263+
264+
247265
def test_cache_list_too_many_args(script):
248266
"""Passing `pip cache list` too many arguments should cause an error."""
249267
script.pip("cache", "list", "aaa", "bbb", expect_error=True)

0 commit comments

Comments
 (0)