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

Inform users that challenges can be flaky #4616

Merged
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
7 changes: 5 additions & 2 deletions tests/challenges/challenge_decorator/challenge_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
1 # we will attempt to beat 1 level above the current level for now.
)

waynehamadi marked this conversation as resolved.
Show resolved Hide resolved
CHALLENGE_FAILED_MESSAGE = "Challenges can sometimes fail randomly, please run this test again and if it fails reach out to us on https://discord.gg/autogpt and reach out to us on the 'challenges' channel to let us know the challenge you're struggling with."


def challenge(func: Callable[..., Any]) -> Callable[..., None]:
@wraps(func)
Expand All @@ -34,7 +36,9 @@ def wrapper(*args: Any, **kwargs: Any) -> None:
func(*args, **kwargs)
challenge.succeeded = True
except AssertionError as err:
original_error = err
original_error = AssertionError(
f"{CHALLENGE_FAILED_MESSAGE}\n{err}"
)
challenge.succeeded = False
else:
challenge.skipped = True
Expand All @@ -54,7 +58,6 @@ def wrapper(*args: Any, **kwargs: Any) -> None:
pytest.xfail("Challenge failed")
if original_error:
raise original_error
raise AssertionError("Challenge failed")
run_remaining -= 1

return wrapper
Expand Down