sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.43k stars 425 forks source link

Sweep: Refactor tests/test_run_example_webhook.py to comply with coding rules #1793

Open sweep-nightly[bot] opened 1 year ago

sweep-nightly[bot] commented 1 year ago

The file tests/test_run_example_webhook.py does not comply with our coding rules in two areas:

  1. There is a commented out line of code # port = "http://127.0.0.1:8080" which is not a docstring or explanation. This line should be removed if it is not needed.

  2. In the try-except block, the exception is not logged using traceback. Instead, a print statement is used. This should be replaced with a traceback log. Here is the current code:

    try:
    response = requests.get(host)
    if response.status_code == 200:
        break
    except:
    print(
        f"Waited for server to start ({i+1}s)"
        + ("." * (i % 4) + " " * (4 - (i % 4))),
        end="\r",
    )
    time.sleep(1)
    continue

    This should be replaced with:

    import traceback
    try:
    response = requests.get(host)
    if response.status_code == 200:
        break
    except Exception as e:
    traceback.print_exc()
    print(
        f"Waited for server to start ({i+1}s)"
        + ("." * (i % 4) + " " * (4 - (i % 4))),
        end="\r",
    )
    time.sleep(1)
    continue
Checklist - [ ] `tests/test_run_example_webhook.py`
❌ Unable to modify files in `tests/` Edit `sweep.yaml` to configure.
sweep-nightly[bot] commented 1 year ago
Sweeping

50%

Actions (click)


❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists contact team@sweep.dev.

For bonus GPT-4 tickets, please report this bug on Discord.


Please look at the generated plan. If something looks wrong, please add more details to your issue.

File Path Proposed Changes
tests/test_run_example_webhook.py Modify tests/test_run_example_webhook.py with contents:
❌ Unable to modify files in tests/
Edit sweep.yaml to configure.

🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.