Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cleanup #221

Merged
merged 1 commit into from
Dec 9, 2022
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
20 changes: 8 additions & 12 deletions tests/integration/models/reddit/test_subreddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,13 +794,11 @@ async def test_add__subreddit_model(self, reddit):
subreddit = await reddit.subreddit("all")
await subreddit.filters.add(await reddit.subreddit("redditdev"))

# @mock.patch("asyncio.sleep", return_value=None) # FIXME: no longer raises not found; same with praw
# async def test_add__non_special(self, reddit):
# async def test_add__non_special(self, reddit): # FIXME: no longer raises not found; same with praw
# reddit.read_only = False
# with self.use_cassette():
# with pytest.raises(NotFound):
# subreddit = await reddit.subreddit("redditdev")
# await subreddit.filters.add("redditdev")
# with pytest.raises(NotFound):
# subreddit = await reddit.subreddit("redditdev")
# await subreddit.filters.add("redditdev")

async def test_remove(self, reddit):
reddit.read_only = False
Expand All @@ -813,13 +811,11 @@ async def test_remove__subreddit_model(self, reddit):
subreddit = await reddit.subreddit("mod")
await subreddit.filters.remove(await reddit.subreddit("redditdev"))

# @mock.patch("asyncio.sleep", return_value=None) # FIXME: no longer rases not found; same with praw
# async def test_remove__non_special(self, reddit):
# async def test_remove__non_special(self, reddit): # FIXME: no longer rases not found; same with praw
# reddit.read_only = False
# with self.use_cassette():
# with pytest.raises(NotFound):
# subreddit = await reddit.subreddit("redditdev")
# await subreddit.filters.remove("redditdev")
# with pytest.raises(NotFound):
# subreddit = await reddit.subreddit("redditdev")
# await subreddit.filters.remove("redditdev")


class TestSubredditFlair(IntegrationTest):
Expand Down
7 changes: 1 addition & 6 deletions tests/unit/models/test_util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""Test asyncpraw.models.util."""
from collections import namedtuple
from unittest import mock

import pytest

from asyncpraw.models.util import (
BoundedSet,
Expand Down Expand Up @@ -78,9 +75,7 @@ def test_lru_contains(self):


class TestStream(UnitTest):
@pytest.mark.asyncio
@mock.patch("asyncio.sleep", return_value=None)
async def test_stream(self, _):
async def test_stream(self):
Thing = namedtuple("Thing", ["fullname"])
initial_things = [Thing(n) for n in reversed(range(100))]
counter = 99
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ async def test_post_ratelimit__over_threshold__seconds(self, mock_sleep, _, redd
},
],
)
@mock.patch("asyncio.sleep", return_value=None)
async def test_post_ratelimit__over_threshold__minutes(self, _, __, reddit):
async def test_post_ratelimit__over_threshold__minutes(self, _, reddit):
with pytest.raises(RedditAPIException) as exception:
await reddit.post("test")
assert (
Expand Down