Skip to content

Commit 5cc9bd9

Browse files
authored
Merge pull request #79 from scrapfly/fix-reddit-scraper
Add rerunfailures
2 parents 4ac7389 + c05a1f3 commit 5cc9bd9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

reddit-scraper/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ readme = "README.md"
1010
python = "^3.10"
1111
scrapfly-sdk = {extras = ["all"], version = "^0.8.5"}
1212
loguru = "^0.7.1"
13+
pytest-rerunfailures = "^14.0"
1314

1415
[tool.poetry.group.dev.dependencies]
1516
black = "^23.3.0"

reddit-scraper/test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def require_min_presence(items, key, min_perc=0.1):
149149

150150

151151
@pytest.mark.asyncio
152+
@pytest.mark.flaky(reruns=3, reruns_delay=30)
152153
async def test_subreddit_scraping():
153154
subreddit_data = await reddit.scrape_subreddit(
154155
subreddit_id="wallstreetbets",
@@ -165,6 +166,7 @@ async def test_subreddit_scraping():
165166

166167

167168
@pytest.mark.asyncio
169+
@pytest.mark.flaky(reruns=3, reruns_delay=30)
168170
async def test_post_scraping():
169171
post_data = await reddit.scrape_post(
170172
url="https://www.reddit.com/r/wallstreetbets/comments/1c4vwlp/what_are_your_moves_tomorrow_april_16_2024/",
@@ -181,6 +183,7 @@ async def test_post_scraping():
181183

182184

183185
@pytest.mark.asyncio
186+
@pytest.mark.flaky(reruns=3, reruns_delay=30)
184187
async def test_user_post_scraping():
185188
user_post_data = await reddit.scrape_user_posts(
186189
username="Scrapfly",
@@ -198,6 +201,7 @@ async def test_user_post_scraping():
198201

199202

200203
@pytest.mark.asyncio
204+
@pytest.mark.flaky(reruns=3, reruns_delay=30)
201205
async def test_user_comment_scraping():
202206
user_comment_data = await reddit.scrape_user_comments(
203207
username="Scrapfly",

0 commit comments

Comments
 (0)