Skip to content

Commit

Permalink
Fix weird test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jul 27, 2021
1 parent a9928d1 commit b07604a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/unit/__init__.py
Expand Up @@ -13,5 +13,5 @@ async def setUp(self):
client_id="dummy", client_secret="dummy", user_agent="dummy"
)
# Unit tests should never issue requests
await self.reddit._core.close()
await self.reddit.close()
self.reddit._core._requestor._http = None
12 changes: 8 additions & 4 deletions tests/unit/test_deprecations.py
Expand Up @@ -10,6 +10,10 @@

from . import UnitTest

pytestmark = pytest.mark.filterwarnings(
"ignore:Unclosed client session", category=ResourceWarning
)


@pytest.mark.filterwarnings("error", category=DeprecationWarning)
class TestDeprecation(UnitTest):
Expand Down Expand Up @@ -86,16 +90,16 @@ async def test_reddit_user_me_read_only(self):

async def test_reddit_token_manager(self):
with pytest.raises(DeprecationWarning):
self.reddit = Reddit(
async with Reddit(
client_id="dummy",
client_secret=None,
redirect_uri="dummy",
user_agent="dummy",
token_manager=FileTokenManager("name"),
)
await self.reddit._core.close()
) as reddit:
reddit._core._requestor._http = None

def test_synchronous_context_manager(self):
async def test_synchronous_context_manager(self):
with pytest.raises(DeprecationWarning) as excinfo:
with self.reddit:
pass
Expand Down

0 comments on commit b07604a

Please sign in to comment.