add exit for single manga
All checks were successful
ci/woodpecker/push/tests Pipeline was successful

This commit is contained in:
Ivan Schaller 2023-02-12 02:25:09 +01:00
parent 5eb333f1ca
commit d64964e7cc
Signed by: olofvndrhr
GPG key ID: 2A6BE07D99C8C205
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,4 @@
import sys
from pathlib import Path
import click
@ -276,6 +277,11 @@ def main(
)
mdlp.get_manga()
except (KeyboardInterrupt, Exception) as exc:
# if only a single manga is requested and had an error, then exit
if len(requested_mangas) == 1:
log.error(f"Error with manga: {manga}")
sys.exit(1)
# else continue with the other ones
log.error(f"Skipping: {manga}. Reason={exc}")

View file

@ -13,7 +13,6 @@ def test_check_api_mangadex():
def test_check_api_none():
url = "https://abc.defghjk/title/abc/def"
with pytest.raises(SystemExit) as e:
with pytest.raises(ValueError) as e:
MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
assert e.type == SystemExit
assert e.value.code == 1
assert e.type == ValueError