Skip to content

Commit

Permalink
Merge pull request #221 from praw-dev/more_test_cleanup
Browse files Browse the repository at this point in the history
Test cleanup
  • Loading branch information
LilSpazJoekp authored Dec 9, 2022
2 parents 08f4012 + 0bf0bb8 commit fc84a89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
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

0 comments on commit fc84a89

Please sign in to comment.