Skip to content

Commit

Permalink
fix(tests): do not sys exit on comments open
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jul 2, 2024
1 parent 36f550e commit d9c2bf1
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions geotribu_cli/comments/comments_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# standard library
import argparse
import logging
import sys
from os import getenv

from geotribu_cli.cli_results_rich_formatters import format_output_result_comments
Expand Down Expand Up @@ -131,21 +130,20 @@ def run(args: argparse.Namespace):
logger.error(
f"Une erreur a empêché la récupération des commentaires. Trace: {err}"
)
sys.exit(1)

# si le commentaire n'a pas été trouvé
if not isinstance(comment_obj, Comment):
if isinstance(comment_obj, Comment):
if args.open_with == "shell":
console.print(
format_output_result_comments(
results=[comment_obj], format_type=args.format_output, count=1
)
)
else:
open_uri(in_filepath=comment_obj.url_to_comment)

else:
console.print(
f":person_shrugging: Le commentaire {args.comment_id} n'a pu être trouvé. "
"Est-il publié et validé ?"
)
sys.exit(0)

if args.open_with == "shell":
console.print(
format_output_result_comments(
results=[comment_obj], format_type=args.format_output, count=1
)
)
else:
open_uri(in_filepath=comment_obj.url_to_comment)

0 comments on commit d9c2bf1

Please sign in to comment.