Skip to content
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
4 changes: 3 additions & 1 deletion skills/upgrading-sdk-v2/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Increment the **major** version since the SDK dependency is a breaking change:

If the integration was already at a higher version (e.g. `1.1.0`), bump to `2.0.0`.

> **This step only applies to existing integrations being upgraded.** A brand-new integration written directly against SDK 2.0.0 should start at `"version": "1.0.0"` — the integration's own version reflects its release history, not the SDK version.

### Step 5 — Update unit tests (if they exist)

**A. Wrap fetch mocks in FetchResponse:**
Expand Down Expand Up @@ -256,7 +258,7 @@ Before considering an integration upgraded, verify:
- [ ] `ActionError` is imported from the SDK
- [ ] `"error"` and error-only `"result"` properties removed from output schemas in `config.json`
- [ ] `requirements.txt` pins `autohive-integrations-sdk~=2.0.0`
- [ ] `config.json` version is bumped to `2.0.0`
- [ ] `config.json` version is bumped to `2.0.0` (upgrades only — new integrations stay at `1.0.0`)
- [ ] Unit test mocks wrap return values in `FetchResponse(...)`
- [ ] Unit test error assertions use `result.type == ResultType.ACTION_ERROR` and `result.result.message`
- [ ] `pytest.raises(ValidationError)` replaced with `result.type == ResultType.VALIDATION_ERROR`
Expand Down
14 changes: 14 additions & 0 deletions skills/writing-unit-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For small integrations (1–10 actions), a single file is fine:
```
myintegration/tests/
├── __init__.py
├── conftest.py
└── test_myintegration_unit.py
```

Expand All @@ -29,6 +30,7 @@ For large integrations (10+ actions), split by domain:
```
hubspot/tests/
├── __init__.py
├── conftest.py
├── test_hubspot_helpers_unit.py
├── test_hubspot_contacts_unit.py
├── test_hubspot_companies_unit.py
Expand All @@ -38,6 +40,18 @@ hubspot/tests/
└── test_hubspot_misc_unit.py
```

### conftest.py

Every `tests/` directory should include a `conftest.py` with this standard content:

```python
import sys
import os

# Allow 'from context import ...' to work when pytest runs from repo root
sys.path.insert(0, os.path.dirname(__file__))
```

The `_unit.py` suffix is required — CI uses it to discover unit tests.

### File Header (boilerplate)
Expand Down
Loading