Skip to content

Commit 318ee07

Browse files
committed
test: test async method powerup
1 parent 5f1e26a commit 318ee07

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/stdlib_basics/test_session.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from mellea.stdlib.chat import Message
1010
from mellea.stdlib.session import start_session, MelleaSession
1111

12+
import time
13+
1214

1315
# We edit the context type in the async tests below. Don't change the scope here.
1416
@pytest.fixture(scope="function")
@@ -138,20 +140,25 @@ class TestPowerup:
138140
def hello(m: MelleaSession):
139141
return "hello"
140142

141-
class TestPowerupInherit(TestPowerup):
142-
def hello2(m:MelleaSession):
143+
async def ahello(m: MelleaSession):
144+
time.sleep(3)
143145
return "hello"
144146

145147

146-
def test_powerup(m_session):
148+
class TestPowerupInherit(TestPowerup):
149+
def hello2(m: MelleaSession):
150+
return "hello"
151+
147152

153+
async def test_powerup(m_session):
148154
MelleaSession.powerup(TestPowerup)
149155

150156
assert "hello" == m_session.hello()
157+
assert "hello" == await m_session.ahello()
151158

152159
MelleaSession.powerup(TestPowerupInherit)
153160

154-
assert "hello" == m_session.hello() # check the inheritance is respected
161+
assert "hello" == m_session.hello() # check the inheritance is respected
155162
assert "hello" == m_session.hello2()
156163

157164

0 commit comments

Comments
 (0)