Skip to content

Commit dafbd11

Browse files
authored
Rearrange tests & fix CI (Significant-Gravitas#4596)
* Rearrange tests into unit/integration/challenge categories * Fix linting + `tests.challenges` imports * Fix obscured duplicate test in test_url_validation.py * Move VCR conftest to tests.vcr * Specify tests to run & their order (unit -> integration -> challenges) in CI * Fail Docker CI when tests fail * Fix import & linting errors in tests * Fix `get_text_summary` * Fix linting errors * Clean up pytest args in CI * Remove bogus tests from GoCodeo
1 parent 8a881f7 commit dafbd11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+150
-377
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ master, ci-test* ]
66
paths-ignore:
77
- 'tests/Auto-GPT-test-cassettes'
8-
- 'tests/integration/challenges/current_score.json'
8+
- 'tests/challenges/current_score.json'
99
pull_request:
1010
branches: [ stable, master ]
1111
pull_request_target:
@@ -148,8 +148,9 @@ jobs:
148148
149149
- name: Run pytest with coverage
150150
run: |
151-
pytest -n auto --cov=autogpt --cov-report term-missing --cov-branch --cov-report xml --cov-report term
152-
python tests/integration/challenges/utils/build_current_score.py
151+
pytest -n auto --cov=autogpt --cov-branch --cov-report term-missing --cov-report xml \
152+
tests/unit tests/integration tests/challenges
153+
python tests/challenges/utils/build_current_score.py
153154
env:
154155
CI: true
155156
PROXY: ${{ secrets.PROXY }}
@@ -179,7 +180,7 @@ jobs:
179180
- name: Push updated challenge scores
180181
if: github.event_name == 'push'
181182
run: |
182-
score_file="tests/integration/challenges/current_score.json"
183+
score_file="tests/challenges/current_score.json"
183184
184185
if ! git diff --quiet $score_file; then
185186
git add $score_file

.github/workflows/docker-ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ master ]
66
paths-ignore:
77
- 'tests/Auto-GPT-test-cassettes'
8-
- 'tests/integration/challenges/current_score.json'
8+
- 'tests/challenges/current_score.json'
99
pull_request:
1010
branches: [ master, stable ]
1111

@@ -108,15 +108,18 @@ jobs:
108108
set +e
109109
test_output=$(
110110
docker run --env CI --env OPENAI_API_KEY --entrypoint python ${{ env.IMAGE_NAME }} -m \
111-
pytest -n auto --cov=autogpt --cov-report term-missing --cov-branch --cov-report xml --cov-report term 2>&1
111+
pytest -n auto --cov=autogpt --cov-branch --cov-report term-missing \
112+
tests/unit tests/integration 2>&1
112113
)
113114
test_failure=$?
114-
115+
115116
echo "$test_output"
116-
117+
117118
cat << $EOF >> $GITHUB_STEP_SUMMARY
118119
# Tests $([ $test_failure = 0 ] && echo '✅' || echo '❌')
119120
\`\`\`
120121
$test_output
121122
\`\`\`
122123
$EOF
124+
125+
exit $test_failure

.github/workflows/pr-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [ master ]
77
paths-ignore:
88
- 'tests/Auto-GPT-test-cassettes'
9-
- 'tests/integration/challenges/current_score.json'
9+
- 'tests/challenges/current_score.json'
1010
# So that the `dirtyLabel` is removed if conflicts are resolve
1111
# We recommend `pull_request_target` so that github secrets are available.
1212
# In `pull_request` we wouldn't be able to change labels of fork PRs

autogpt/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def get_text_summary(url: str, question: str, config: Config) -> str:
142142
Returns:
143143
str: The summary of the text
144144
"""
145-
text = scrape_text(url)
145+
text = scrape_text(url, config)
146146
summary, _ = summarize_text(text, question=question)
147147

148148
return f""" "Result" : {summary}"""

docs/challenges/building_challenges.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def kubernetes_agent(
7070
```
7171

7272
## Creating your challenge
73-
Go to `tests/integration/challenges`and create a file that is called `test_your_test_description.py` and add it to the appropriate folder. If no category exists you can create a new one.
73+
Go to `tests/challenges`and create a file that is called `test_your_test_description.py` and add it to the appropriate folder. If no category exists you can create a new one.
7474

7575
Your test could look something like this
7676

@@ -84,7 +84,7 @@ import yaml
8484

8585
from autogpt.commands.file_operations import read_file, write_to_file
8686
from tests.integration.agent_utils import run_interaction_loop
87-
from tests.integration.challenges.utils import run_multiple_times
87+
from tests.challenges.utils import run_multiple_times
8888
from tests.utils import requires_api_key
8989

9090

docs/challenges/information_retrieval/challenge_a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Command to try**:
66

77
```
8-
pytest -s tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py --level=2
8+
pytest -s tests/challenges/information_retrieval/test_information_retrieval_challenge_a.py --level=2
99
```
1010

1111
## Description

docs/challenges/information_retrieval/challenge_b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Command to try**:
66

77
```
8-
pytest -s tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_b.py
8+
pytest -s tests/challenges/information_retrieval/test_information_retrieval_challenge_b.py
99
```
1010

1111
## Description

docs/challenges/memory/challenge_b.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Command to try**:
66
```
7-
pytest -s tests/integration/challenges/memory/test_memory_challenge_b.py --level=3
7+
pytest -s tests/challenges/memory/test_memory_challenge_b.py --level=3
88
``
99
1010
## Description
@@ -41,4 +41,3 @@ Write all the task_ids into the file output.txt. The file has not been created y
4141
## Objective
4242
4343
The objective of this challenge is to test the agent's ability to follow instructions and maintain memory of the task IDs throughout the process. The agent successfully completed this challenge if it wrote the task ids in a file.
44-

docs/challenges/memory/challenge_c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Command to try**:
66
```
7-
pytest -s tests/integration/challenges/memory/test_memory_challenge_c.py --level=2
7+
pytest -s tests/challenges/memory/test_memory_challenge_c.py --level=2
88
``
99
1010
## Description

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
follow_imports = skip
33
check_untyped_defs = True
44
disallow_untyped_defs = True
5-
files = tests/integration/challenges/**/*.py
5+
files = tests/challenges/**/*.py
66

77
[mypy-requests.*]
88
ignore_missing_imports = True

0 commit comments

Comments
 (0)