feat(dl): add --max-downloads to stop a run after N downloaded titles

This commit is contained in:
imSp4rky
2026-12-04 12:33:18 -07:00
parent 516ae82f4d
commit 8e850d168e
10 changed files with 119 additions and 2 deletions
+5 -1
View File
@@ -163,12 +163,16 @@ def test_null_takes_the_api_default():
assert cast_dl_params(dl.cli, {key: None for key in DEFAULT_DOWNLOAD_PARAMS}) == cast_dl_params(dl.cli, {})
@pytest.mark.parametrize("key", ["downloads", "workers", "channels", "latest_episodes"])
@pytest.mark.parametrize("key", ["downloads", "workers", "channels", "latest_episodes", "max_downloads"])
def test_a_boolean_is_not_a_number(key):
with pytest.raises(click.BadParameter, match=f"Invalid {key}: expected a number"):
cast_dl_params(dl.cli, {key: True})
def test_max_downloads_must_be_a_positive_integer():
assert refusal({"max_downloads": 0}) == "max_downloads must be a positive integer"
@pytest.mark.parametrize("value", [[1], [None], {"a": 1}])
def test_a_non_string_range_is_a_validation_error(value):
assert (refusal({"range": value}) or "").startswith("Invalid range")