def test_warn(): with pytest.warns(DeprecationWarning) as ctx: helpers.deprecated_noop('Text') w = ctx.list[0] assert str(w.message) == 'Text' # Assert the warning points at us and not at _CoroGuard. assert w.filename == __file__
def test_warn(): with pytest.warns(DeprecationWarning) as ctx: helpers.deprecated_noop('Text') w = ctx.list[0] assert str(w.message) == 'Text' # Assert the warning points at us and not at _CoroGuard. assert w.filename == __file__
def close(self): """ 对ClientSession类的close方法进行重写 """ if not self.closed: if self._connector_owner: self._connector.close() connector.append(self._connector) return deprecated_noop('ClientSession.close() is a coroutine')
def test_no_warn_on_await(): with pytest.warns(None) as ctx: yield from helpers.deprecated_noop('Text') assert not ctx.list
def test_coro_guard_close(): guard = helpers.deprecated_noop('Text') guard.close() assert not guard.gi_running
def test_warn(): with pytest.warns(DeprecationWarning) as ctx: helpers.deprecated_noop('Text') assert str(ctx.list[0].message) == 'Text'
def test_no_warn_on_await(): with pytest.warns(None) as ctx: yield from helpers.deprecated_noop('Text') assert not ctx.list
def test_warn(): with pytest.warns(DeprecationWarning) as ctx: helpers.deprecated_noop('Text') assert str(ctx.list[0].message) == 'Text'