Skip to content

Commit

Permalink
Bump pytest-asyncio from 0.17.2 to 0.18.0 (#1009)
Browse files Browse the repository at this point in the history
* Bump pytest-asyncio from 0.17.2 to 0.18.0

Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.17.2 to 0.18.0.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](pytest-dev/pytest-asyncio@v0.17.2...v0.18.0)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix warnings in tests

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: davfsa <davfsa@gmail.com>
  • Loading branch information
dependabot[bot] and davfsa authored Feb 7, 2022
1 parent faeeda8 commit 92f5be6
Show file tree
Hide file tree
Showing 7 changed files with 777 additions and 741 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mock==4.0.3

# Py.test stuff.
pytest==7.0.0
pytest-asyncio==0.17.2
pytest-asyncio==0.18.0
pytest-cov==3.0.0
pytest-randomly==3.11.0

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ norecursedirs = [
"public",
"ci",
]
filterwarnings = ["ignore:.*\"@coroutine\" decorator is deprecated.*:DeprecationWarning"]
filterwarnings = ["ignore:.*assertions not in test modules or plugins will be ignored because assert statements are not executed by the underlying Python interpreter.*:pytest.PytestConfigWarning"]

[tool.towncrier]
package = "hikari"
Expand Down
4 changes: 3 additions & 1 deletion tests/hikari/events/test_channel_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ async def test_fetch_invite(self, event):
event.app.rest.fetch_invite.assert_awaited_once_with("Jx4cNGG")


@pytest.mark.asyncio()
class TestInviteCreateEvent:
@pytest.fixture()
def event(self):
Expand All @@ -184,14 +183,17 @@ def event(self):
def test_app_property(self, event):
assert event.app is event.invite.app

@pytest.mark.asyncio()
async def test_channel_id_property(self, event):
event.invite.channel_id = 123
assert event.channel_id == 123

@pytest.mark.asyncio()
async def test_guild_id_property(self, event):
event.invite.guild_id = 123
assert event.guild_id == 123

@pytest.mark.asyncio()
async def test_code_property(self, event):
event.invite.code = "Jx4cNGG"
assert event.code == "Jx4cNGG"
Expand Down
11 changes: 7 additions & 4 deletions tests/hikari/events/test_typing_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from tests.hikari import hikari_test_helpers


@pytest.mark.asyncio()
class TestTypingEvent:
@pytest.fixture()
def event(self):
Expand All @@ -42,22 +41,21 @@ def event(self):

return cls()

async def test_get_user_when_no_cache(self, event):
def test_get_user_when_no_cache(self, event):
event = hikari_test_helpers.mock_class_namespace(typing_events.TypingEvent, app=None)()

assert event.get_user() is None

def test_get_user(self, event):
assert event.get_user() is event.app.cache.get_user.return_value

async def test_trigger_typing(self, event):
def test_trigger_typing(self, event):
event.app.rest.trigger_typing = mock.Mock()
result = event.trigger_typing()
event.app.rest.trigger_typing.assert_called_once_with(123)
assert result is event.app.rest.trigger_typing.return_value


@pytest.mark.asyncio()
class TestGuildTypingEvent:
@pytest.fixture()
def event(self):
Expand Down Expand Up @@ -87,6 +85,7 @@ def test_get_channel(self, event, guild_channel_impl):
assert result is event.app.cache.get_guild_channel.return_value
event.app.cache.get_guild_channel.assert_called_once_with(123)

@pytest.mark.asyncio()
async def test_get_guild_when_no_cache(self):
event = hikari_test_helpers.mock_class_namespace(typing_events.GuildTypingEvent, app=None, init_=False)()

Expand All @@ -111,23 +110,27 @@ def test_user_id(self, event):
assert event.user_id == event.member.id
assert event.user_id == 456

@pytest.mark.asyncio()
@pytest.mark.parametrize("guild_channel_impl", [channels.GuildNewsChannel, channels.GuildTextChannel])
async def test_fetch_channel(self, event, guild_channel_impl):
event.app.rest.fetch_channel = mock.AsyncMock(return_value=mock.Mock(spec_set=guild_channel_impl))
await event.fetch_channel()

event.app.rest.fetch_channel.assert_awaited_once_with(123)

@pytest.mark.asyncio()
async def test_fetch_guild(self, event):
await event.fetch_guild()

event.app.rest.fetch_guild.assert_awaited_once_with(789)

@pytest.mark.asyncio()
async def test_fetch_guild_preview(self, event):
await event.fetch_guild_preview()

event.app.rest.fetch_guild_preview.assert_awaited_once_with(789)

@pytest.mark.asyncio()
async def test_fetch_member(self, event):
await event.fetch_member()

Expand Down
Loading

0 comments on commit 92f5be6

Please sign in to comment.