Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
579 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
testpaths = tests | ||
filterwarnings = | ||
ignore::DeprecationWarning | ||
asyncio_mode = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
"""Async PRAW Test Suite.""" | ||
|
||
|
||
class HelperMethodMixin: | ||
@staticmethod | ||
async def async_list(async_generator): | ||
"""Return a list from an async iterator.""" | ||
return [item async for item in async_generator] | ||
|
||
@staticmethod | ||
async def async_next(async_generator): | ||
"""Return the next item from an async iterator.""" | ||
return await async_generator.__anext__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
"""PRAW Unit test suite.""" | ||
import asynctest | ||
"""Async PRAW Unit test suite.""" | ||
from tests import HelperMethodMixin | ||
|
||
from asyncpraw import Reddit | ||
|
||
|
||
class UnitTest(asynctest.TestCase): | ||
"""Base class for PRAW unit tests.""" | ||
|
||
async def setUp(self): | ||
"""Setup runs before all test cases.""" | ||
self.reddit = Reddit( | ||
client_id="dummy", client_secret="dummy", user_agent="dummy" | ||
) | ||
# Unit tests should never issue requests | ||
await self.reddit.close() | ||
self.reddit._core._requestor._http = None | ||
class UnitTest(HelperMethodMixin): | ||
"""Base class for Async PRAW unit tests.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
|
||
from asyncpraw import Reddit | ||
|
||
|
||
@pytest.fixture | ||
async def reddit(): | ||
async with Reddit( | ||
client_id="dummy", client_secret="dummy", user_agent="dummy" | ||
) as reddit: | ||
# Unit tests should never issue requests | ||
yield reddit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.