From 7c62c7ffc1998e68c322cb65ca64f102e3e68eaa Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Tue, 2 Jul 2024 21:19:15 +0200 Subject: [PATCH 1/5] =?UTF-8?q?change(print):=20utilise=20console.print=20?= =?UTF-8?q?plut=C3=B4t=20que=20print=20directement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- geotribu_cli/comments/comments_open.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/geotribu_cli/comments/comments_open.py b/geotribu_cli/comments/comments_open.py index b9b7cd8..15fcf96 100644 --- a/geotribu_cli/comments/comments_open.py +++ b/geotribu_cli/comments/comments_open.py @@ -10,13 +10,12 @@ import sys from os import getenv -# 3rd party -from rich import print - -# package from geotribu_cli.cli_results_rich_formatters import format_output_result_comments from geotribu_cli.comments.comments_toolbelt import find_comment_by_id from geotribu_cli.comments.mdl_comment import Comment + +# package +from geotribu_cli.console import console from geotribu_cli.constants import GeotribuDefaults from geotribu_cli.utils.start_uri import open_uri @@ -136,14 +135,14 @@ def run(args: argparse.Namespace): # si le commentaire n'a pas été trouvé if not isinstance(comment_obj, Comment): - print( + 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": - print( + console.print( format_output_result_comments( results=[comment_obj], format_type=args.format_output, count=1 ) From 36f550ea766231dd5de3794f7d5ef5f064a5da97 Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Tue, 2 Jul 2024 21:19:33 +0200 Subject: [PATCH 2/5] fix(tests): increase API page and enable verbose mode --- tests/test_cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 3c1f0c6..2a97605 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -86,11 +86,12 @@ def test_cli_run_comments_open_specific(capsys): "comments", "open", "--page-size", - "25", + "100", "--comment-id", "15", "--expiration-rotating-hours", "0", + "-vv", ] ) From d9c2bf1eb2299e3dbeb7f1b8b4f71abfdd4c9094 Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Tue, 2 Jul 2024 21:28:00 +0200 Subject: [PATCH 3/5] fix(tests): do not sys exit on comments open --- geotribu_cli/comments/comments_open.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/geotribu_cli/comments/comments_open.py b/geotribu_cli/comments/comments_open.py index 15fcf96..ea42561 100644 --- a/geotribu_cli/comments/comments_open.py +++ b/geotribu_cli/comments/comments_open.py @@ -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 @@ -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) From 3d178c798cccbf569062ee248f018e0960a7ad79 Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Tue, 2 Jul 2024 21:36:22 +0200 Subject: [PATCH 4/5] release: bump version (just to trigger stucked CI) --- geotribu_cli/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geotribu_cli/__about__.py b/geotribu_cli/__about__.py index e623aae..e42dc60 100644 --- a/geotribu_cli/__about__.py +++ b/geotribu_cli/__about__.py @@ -38,7 +38,7 @@ __uri__ = __uri_repository__ -__version__ = "0.34.0" +__version__ = "0.34.1" __version_info__ = tuple( [ int(num) if num.isdigit() else num From c55063c3900c91d10e7d8bfc811e1a3c7232856f Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Tue, 2 Jul 2024 21:43:10 +0200 Subject: [PATCH 5/5] =?UTF-8?q?improve(tests):=20ajoute=20une=20commande?= =?UTF-8?q?=20de=20recherche=20aux=20tests=20d'int=C3=A9gration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4f441b..65605ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -108,3 +108,6 @@ jobs: - name: CLI - Echoing help run: geotribu --help + + - name: CLI - Search content + run: geotribu search-content --no-prompt -n 10 "python +osm"