I have the following class and I'm writing a test on method2
.
y.py
class C:
@classmethod
async def method1(cls): # to be mocked
pass
@classmethod
async def method2(cls): # to be tested
await cls.method1()
I have the following
from asyncio import Future
from unittest.mock import Mock
import pytest
from y import C
@pytest.mark.asyncio
async def test_method2():
C.method1 = Mock(return_value=Future())
await C.method2()
C.method1.assert_called_once()
However, it hangs when running python -m pytest test.py
?