You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Stop silently swallowing exceptions in request queue ([#777](https://github.com/apify/apify-sdk-python/pull/777)) ([6358d66](https://github.com/apify/apify-sdk-python/commit/6358d66aeb83484845b17f7c8632b6c763cef368)) by [@vdusek](https://github.com/vdusek)
14
+
- Handle TimeoutError in Actor __aexit__ to prevent resource leaks ([#776](https://github.com/apify/apify-sdk-python/pull/776)) ([fb13765](https://github.com/apify/apify-sdk-python/commit/fb13765448a2a6e2b776de819ece68f90abff1e3)) by [@vdusek](https://github.com/vdusek)
15
+
- Pass name instead of id for name param in SmartApifyStorageClient ([#775](https://github.com/apify/apify-sdk-python/pull/775)) ([56cfc38](https://github.com/apify/apify-sdk-python/commit/56cfc38aa98a2a6689dd077e9d5c5d8729872413)) by [@vdusek](https://github.com/vdusek)
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,26 @@ To run the documentation locally (requires Node.js):
118
118
uv run poe run-docs
119
119
```
120
120
121
+
## Commits
122
+
123
+
We use [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages. This convention is used to automatically determine version bumps during the release process.
124
+
125
+
### Available commit types
126
+
127
+
| Type | Description |
128
+
| ---- | ----------- |
129
+
|`feat`| A new feature |
130
+
|`fix`| A bug fix |
131
+
|`docs`| Documentation only changes |
132
+
|`style`| Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
133
+
|`refactor`| A code change that neither fixes a bug nor adds a feature |
134
+
|`perf`| A code change that improves performance |
135
+
|`test`| Adding missing tests or correcting existing tests |
136
+
|`build`| Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
137
+
|`ci`| Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) |
138
+
|`chore`| Other changes that don't modify src or test files |
139
+
|`revert`| Reverts a previous commit |
140
+
121
141
## Release process
122
142
123
143
Publishing new versions to [PyPI](https://pypi.org/project/apify) is automated through GitHub Actions.
These tests build and run Actors using the Python SDK on the Apify platform. They are slower than integration tests (see [`tests/integration/`](../integration/)) because they need to build and deploy Actors.
4
+
5
+
When writing new tests, prefer integration tests if possible. Only write E2E tests when you need to test something that requires building and running an Actor on the platform.
6
+
7
+
## Running
8
+
9
+
```bash
10
+
export APIFY_TEST_USER_API_TOKEN=<your-token>
11
+
uv run poe e2e-tests
12
+
```
13
+
14
+
To run against a different environment, also set `APIFY_INTEGRATION_TESTS_API_URL`.
15
+
16
+
## Key fixtures
17
+
18
+
-**`apify_client_async`** — A session-scoped `ApifyClientAsync` instance configured with the test token and API URL.
19
+
-**`prepare_test_env`** / **`_isolate_test_environment`** (autouse) — Resets global state and sets `APIFY_LOCAL_STORAGE_DIR` to a temporary directory before each test.
20
+
-**`make_actor`** — Factory for creating temporary Actors on the Apify platform (built, then auto-deleted after the test).
21
+
-**`run_actor`** — Starts an Actor run and waits for completion (10 min timeout).
22
+
23
+
## How to write tests
24
+
25
+
### Creating an Actor from a Python function
26
+
27
+
You can create Actors straight from a Python function. This is great because the test Actor source code gets checked by the linter.
28
+
29
+
```python
30
+
asyncdeftest_something(
31
+
make_actor: MakeActorFunction,
32
+
run_actor: RunActorFunction,
33
+
) -> None:
34
+
asyncdefmain() -> None:
35
+
asyncwith Actor:
36
+
print('Hello!')
37
+
38
+
actor =await make_actor(label='something', main_func=main)
39
+
run_result =await run_actor(actor)
40
+
41
+
assert run_result.status =='SUCCEEDED'
42
+
```
43
+
44
+
The `src/main.py` file will be set to the function definition, prepended with `import asyncio` and `from apify import Actor`. You can add extra imports directly inside the function body.
45
+
46
+
### Creating an Actor from source files
47
+
48
+
Pass the `main_py` argument for a single-file Actor:
print('Hello! It is ' + str(get_current_datetime()))
89
+
""",
90
+
}
91
+
actor =await make_actor(label='something', source_files=actor_source_files)
92
+
```
93
+
94
+
### Assertions inside Actors
95
+
96
+
Since test Actors are not executed as standard pytest tests, we don't get introspection of assertion expressions. In case of failure, only a bare `AssertionError` is shown. Always include explicit assertion messages:
0 commit comments