Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: flaky tests #227

Merged
merged 5 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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