Skip to content

Commit 01f5fdc

Browse files
authored
Update repo.md for tests (#37)
1 parent f97f0ae commit 01f5fdc

File tree

3 files changed

+47
-24
lines changed

3 files changed

+47
-24
lines changed

.openhands/microagents/repo.md

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,33 +118,56 @@ When seeing code, make three quick judgments:
118118
"Wrong data structure, should be..."
119119
</ROLE>
120120

121-
<TASK>
122-
# Prototype for OpenHands V1
123-
124-
This project contains my tasks of completely refactor [OpenHands](https://github.com/All-Hands-AI/OpenHands) project V0 into the new V1 version. There's a lot of changes, including (non-exhausive):
125-
126-
- Switching from poetry to uv as package manager
127-
- better dependency management
128-
- include `--dev` group for development only
129-
- stricter pre-commit hooks `.pre-commit-config.yaml` that includes
121+
This repo has two python packages, with unit tests specifically written for each package.
122+
```
123+
├── Makefile
124+
├── README.md
125+
├── examples
126+
├── openhands
127+
│ ├── __init__.py
128+
│ ├── core
129+
│ │ ├── __init__.py
130+
│ │ ├── agent
131+
│ │ ├── config
132+
│ │ ├── context
133+
│ │ ├── conversation
134+
│ │ ├── llm
135+
│ │ ├── logger.py
136+
│ │ ├── pyproject.toml
137+
│ │ ├── tests # <- unit test for openhands/core
138+
│ │ ├── tool
139+
│ │ └── utils
140+
│ └── tools
141+
│ ├── __init__.py
142+
│ ├── execute_bash
143+
│ ├── pyproject.toml
144+
│ ├── str_replace_editor
145+
│ ├── tests # <- unit test for openhands/tools
146+
│ └── utils
147+
├── pyproject.toml
148+
├── tests # <- integration test that involves both openhands/core and openhands/tools
149+
│ ├── __init__.py
150+
└── uv.lock
151+
```
152+
153+
154+
<DEV_SETUP>
155+
- Make sure you `make build` to configure the dependency first
156+
- We use pre-commit hooks `.pre-commit-config.yaml` that includes:
130157
- type check through pyright
131158
- linting and formatter with `uv ruff`
132-
- cleaner architecture for how a tool works and how it is executed
133-
- read about how we define tools: [`openhands/core/runtime/tool.py`](openhands/core/runtime/tool.py)
134-
- read about how we define schema (input/output) for tools: [`openhands/core/runtime/schema.py`](openhands/core/runtime/schema.py)
135-
- read about patterns for how we define an executable tool:
136-
- read [openhands/core/runtime/tools/str_replace_editor/impl.py](openhands/core/runtime/tools/str_replace_editor/impl.py) for tool execute_fn
137-
- read [openhands/core/runtime/tools/str_replace_editor/definition.py](openhands/core/runtime/tools/str_replace_editor/definition.py) for how do we define a tool
138-
- read [openhands/core/runtime/tools/str_replace_editor/__init__.py](openhands/core/runtime/tools/str_replace_editor/__init__.py) for how we define each tool module
139-
- Check how we perform tests in .github/workflows/tests.yml
140-
- ...
141-
</TASK>
142-
143-
<NOTE>
144159
- Do NOT commit ALL the file, just commit the relavant file you've changed!
145160
- in every commit message, you should add "Co-authored-by: openhands <openhands@all-hands.dev>"
146161
- You can run pytest with `uv run pytest`
147-
- Don't write TOO MUCH test, you should write just enough to cover edge cases.
148-
- AFTER you edit ONE file, you should run pre-commit hook on that file via `uv run pre-commit run --files [filepath]` to make sure you didn't break it.
162+
</DEV_SETUP>
163+
164+
<CODE>
149165
- Avoid hacky trick like `sys.path.insert` when resolving package dependency
150-
</NOTE>
166+
</CODE>
167+
168+
<TESTING>
169+
- AFTER you edit ONE file, you should run pre-commit hook on that file via `uv run pre-commit run --files [filepath]` to make sure you didn't break it.
170+
- Don't write TOO MUCH test, you should write just enough to cover edge cases.
171+
- Check how we perform tests in .github/workflows/tests.yml
172+
- You should put unit tests in the corresponding test folder. For example, to test `openhands/core/tool/tool.py`, you should put tests under `openhands/core/tests/tool/test_tool.py`.
173+
</TESTING>

openhands/core/tests/tool/__init__.py

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)