Skip to content

Commit

Permalink
Fix: flaky tests (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts authored Jul 2, 2024
2 parents b6fd486 + c55063c commit 30ce4e4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion geotribu_cli/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 15 additions & 18 deletions geotribu_cli/comments/comments_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
# standard library
import argparse
import logging
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

Expand Down Expand Up @@ -132,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):
print(
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":
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)
3 changes: 2 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
)

Expand Down

0 comments on commit 30ce4e4

Please sign in to comment.