add exit for single manga
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
This commit is contained in:
parent
5eb333f1ca
commit
d64964e7cc
2 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
@ -276,6 +277,11 @@ def main(
|
||||||
)
|
)
|
||||||
mdlp.get_manga()
|
mdlp.get_manga()
|
||||||
except (KeyboardInterrupt, Exception) as exc:
|
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}")
|
log.error(f"Skipping: {manga}. Reason={exc}")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ def test_check_api_mangadex():
|
||||||
|
|
||||||
def test_check_api_none():
|
def test_check_api_none():
|
||||||
url = "https://abc.defghjk/title/abc/def"
|
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)
|
MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
|
||||||
assert e.type == SystemExit
|
assert e.type == ValueError
|
||||||
assert e.value.code == 1
|
|
||||||
|
|
Loading…
Reference in a new issue