Skip to content

Commit 37cc555

Browse files
committed
Merge remote-tracking branch 'origin/master' into crawler-tests
2 parents 346da1e + b3ae5a9 commit 37cc555

File tree

9 files changed

+1269
-178
lines changed

9 files changed

+1269
-178
lines changed

.github/workflows/pre_release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
version_number: ${{ steps.release_metadata.outputs.version_number }}
2121
tag_name: ${{ steps.release_metadata.outputs.tag_name }}
2222
changelog: ${{ steps.release_metadata.outputs.changelog }}
23-
existing_changelog_path: CHANGELOG.md
2423
steps:
2524
- uses: apify/workflows/git-cliff-release@main
2625
id: release_metadata
2726
name: Prepare release metadata
2827
with:
2928
release_type: prerelease
29+
existing_changelog_path: CHANGELOG.md
3030

3131
lint_check:
3232
name: Lint check

.github/workflows/run_code_checks.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ on:
66
# step required for PRs from forks. This prevents their potential exposure.
77
pull_request:
88

9+
# Pushing to the master branch triggers code checks
10+
push:
11+
branches:
12+
- master
13+
tags-ignore:
14+
- "**" # Ignore all tags to prevent duplicate checks when tags are pushed.
15+
16+
# It should also be possible to trigger checks manually
17+
workflow_dispatch:
18+
919
jobs:
1020
lint_check:
1121
name: Lint check

CHANGELOG.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,19 @@ All notable changes to this project will be documented in this file.
150150
- [**breaking**] Drop support for Python 3.8
151151

152152

153-
## [1.7.2](../../releases/tag/v1.7.2) - 2024-07-08
153+
## [1.7.2](https://github.com/apify/apify-sdk-python/releases/tag/v1.7.2) (2024-07-08)
154154

155155
- Add Actor Standby port
156156

157157

158-
## [1.7.1](../../releases/tag/v1.7.1) - 2024-05-23
158+
## [1.7.1](https://github.com/apify/apify-sdk-python/releases/tag/v1.7.1) (2024-05-23)
159159

160160
### 🐛 Bug Fixes
161161

162162
- Set a timeout for Actor cleanup
163163

164164

165-
## [1.7.0](../../releases/tag/v1.7.0) - 2024-03-12
165+
## [1.7.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.7.0) (2024-03-12)
166166

167167
### 🚀 Features
168168

@@ -174,7 +174,7 @@ All notable changes to this project will be documented in this file.
174174
- Scrapy's `Request.dont_filter` works.
175175

176176

177-
## [1.6.0](../../releases/tag/v1.6.0) - 2024-02-23
177+
## [1.6.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.6.0) (2024-02-23)
178178

179179
### 🐛 Bug Fixes
180180

@@ -185,28 +185,28 @@ All notable changes to this project will be documented in this file.
185185
- Remove `ApifyRetryMiddleware` and stay with the Scrapy's default one
186186

187187

188-
## [1.5.5](../../releases/tag/v1.5.5) - 2024-02-01
188+
## [1.5.5](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.5) (2024-02-01)
189189

190190
### 🐛 Bug Fixes
191191

192192
- Fix conversion of `headers` fields in Apify <--> Scrapy request translation
193193

194194

195-
## [1.5.4](../../releases/tag/v1.5.4) - 2024-01-24
195+
## [1.5.4](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.4) (2024-01-24)
196196

197197
### 🐛 Bug Fixes
198198

199199
- Fix conversion of `userData` and `headers` fields in Apify <--> Scrapy request translation
200200

201201

202-
## [1.5.3](../../releases/tag/v1.5.3) - 2024-01-23
202+
## [1.5.3](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.3) (2024-01-23)
203203

204204
### 🚀 Features
205205

206206
- Add `apply_apify_settings` function to Scrapy subpackage
207207

208208

209-
## [1.5.2](../../releases/tag/v1.5.2) - 2024-01-19
209+
## [1.5.2](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.2) (2024-01-19)
210210

211211
### 🐛 Bug Fixes
212212

@@ -220,22 +220,22 @@ All notable changes to this project will be documented in this file.
220220
- Replace asserts with custom checks in Scrapy subpackage
221221

222222

223-
## [1.5.1](../../releases/tag/v1.5.1) - 2024-01-10
223+
## [1.5.1](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.1) (2024-01-10)
224224

225225
### Chore
226226

227227
- Allowed running integration tests from PRs from forks, after maintainer approval
228228
- Do not close `nested_event_loop` in the `Scheduler.__del__`
229229

230230

231-
## [1.5.0](../../releases/tag/v1.5.0) - 2024-01-03
231+
## [1.5.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.5.0) (2024-01-03)
232232

233233
### 🚀 Features
234234

235235
- Add `ApifyHttpProxyMiddleware`
236236

237237

238-
## [1.4.1](../../releases/tag/v1.4.1) - 2023-12-21
238+
## [1.4.1](https://github.com/apify/apify-sdk-python/releases/tag/v1.4.1) (2023-12-21)
239239

240240
### 🐛 Bug Fixes
241241

@@ -246,21 +246,21 @@ All notable changes to this project will be documented in this file.
246246
- Fix type hint problems for resource clients
247247

248248

249-
## [1.4.0](../../releases/tag/v1.4.0) - 2023-12-05
249+
## [1.4.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.4.0) (2023-12-05)
250250

251251
### Chore
252252

253253
- Migrate from Autopep8 and Flake8 to Ruff
254254

255255

256-
## [1.3.0](../../releases/tag/v1.3.0) - 2023-11-15
256+
## [1.3.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.3.0) (2023-11-15)
257257

258258
### 🚀 Features
259259

260260
- Add `scrapy` extra
261261

262262

263-
## [1.2.0](../../releases/tag/v1.2.0) - 2023-10-23
263+
## [1.2.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.2.0) (2023-10-23)
264264

265265
### 🚀 Features
266266

@@ -271,7 +271,7 @@ All notable changes to this project will be documented in this file.
271271
- Fix lint error (E721) in unit tests (for instance checks use `isinstance()`)
272272

273273

274-
## [1.1.5](../../releases/tag/v1.1.5) - 2023-10-03
274+
## [1.1.5](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.5) (2023-10-03)
275275

276276
### 🚀 Features
277277

@@ -283,7 +283,7 @@ All notable changes to this project will be documented in this file.
283283
- Remove PR Toolkit workflow
284284

285285

286-
## [1.1.4](../../releases/tag/v1.1.4) - 2023-09-06
286+
## [1.1.4](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.4) (2023-09-06)
287287

288288
### 🐛 Bug Fixes
289289

@@ -296,15 +296,15 @@ All notable changes to this project will be documented in this file.
296296
- Unpin `apify-client` and `apify-shared` to improve compatibility with their newer versions
297297

298298

299-
## [1.1.3](../../releases/tag/v1.1.3) - 2023-08-25
299+
## [1.1.3](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.3) (2023-08-25)
300300

301301
### Chore
302302

303303
- Unify indentation in configuration files
304304
- Update the `Actor.reboot` method to use the new reboot endpoint
305305

306306

307-
## [1.1.2](../../releases/tag/v1.1.2) - 2023-08-02
307+
## [1.1.2](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.2) (2023-08-02)
308308

309309
### Chore
310310

@@ -314,14 +314,14 @@ All notable changes to this project will be documented in this file.
314314
- Pin `apify-client` and `apify-shared` to prevent their implicit updates from breaking SDK
315315

316316

317-
## [1.1.1](../../releases/tag/v1.1.1) - 2023-05-23
317+
## [1.1.1](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.1) (2023-05-23)
318318

319319
### 🐛 Bug Fixes
320320

321321
- Relax dependency requirements to improve compatibility with other libraries
322322

323323

324-
## [1.1.0](../../releases/tag/v1.1.0) - 2023-05-23
324+
## [1.1.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.1.0) (2023-05-23)
325325

326326
### 🚀 Features
327327

@@ -339,7 +339,7 @@ All notable changes to this project will be documented in this file.
339339
- Switch from `setup.py` to `pyproject.toml` for specifying project setup
340340

341341

342-
## [1.0.0](../../releases/tag/v1.0.0) - 2023-03-13
342+
## [1.0.0](https://github.com/apify/apify-sdk-python/releases/tag/v1.0.0) (2023-03-13)
343343

344344
### 🐛 Bug Fixes
345345

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ keywords = [
3434
"scraping",
3535
]
3636
dependencies = [
37-
"apify-client>=1.11.0",
38-
"apify-shared>=1.3.0",
37+
"apify-client<2.0.0",
38+
"apify-shared<2.0.0",
3939
"crawlee[parsel]~=0.6.0",
4040
"cryptography>=42.0.0",
4141
"httpx>=0.27.0",
@@ -64,7 +64,7 @@ scrapy = ["scrapy>=2.11.0"]
6464
dev = [
6565
"build~=1.2.0",
6666
"dycw-pytest-only>=2.1.1",
67-
"griffe~=1.8.0",
67+
"griffe~=1.9.0",
6868
"mypy~=1.17.0",
6969
"pre-commit~=4.2.0",
7070
"pydoc-markdown~=4.8.0",

tests/integration/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,26 @@ async def test_something(
126126

127127
assert actor_run.status == 'SUCCEEDED'
128128
```
129+
130+
### Asserts
131+
132+
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, without the left and right values. This means, we must include explicit assertion messages to aid potential debugging.
133+
134+
```python
135+
async def test_add_and_fetch_requests(
136+
make_actor: MakeActorFunction,
137+
run_actor: RunActorFunction,
138+
) -> None:
139+
"""Test basic functionality of adding and fetching requests."""
140+
141+
async def main() -> None:
142+
async with Actor:
143+
rq = await Actor.open_request_queue()
144+
await rq.add_request(f'https://apify.com/')
145+
assert is_finished is False, f'is_finished={is_finished}'
146+
147+
actor = await make_actor(label='rq-test', main_func=main)
148+
run_result = await run_actor(actor)
149+
150+
assert run_result.status == 'SUCCEEDED'
151+
```

tests/integration/test_actor_api_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,12 @@ async def main_server() -> None:
400400
async with Actor:
401401

402402
class WebhookHandler(BaseHTTPRequestHandler):
403-
def do_GET(self) -> None:
403+
def do_GET(self) -> None: # noqa: N802
404404
self.send_response(200)
405405
self.end_headers()
406406
self.wfile.write(bytes('Hello, world!', encoding='utf-8'))
407407

408-
def do_POST(self) -> None:
408+
def do_POST(self) -> None: # noqa: N802
409409
nonlocal webhook_body
410410
content_length = self.headers.get('content-length')
411411
length = int(content_length) if content_length else 0

0 commit comments

Comments
 (0)