.. _not-async-context-manager:

not-async-context-manager / E1701
=================================

**Message emitted:**

Async context manager '%s' doesn't implement __aenter__ and __aexit__.

**Description:**

*Used when an async context manager is used with an object that does not implement the async context management protocol.*

**Problematic code:**

.. literalinclude:: /data/messages/n/not-async-context-manager/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/n/not-async-context-manager/good.py
   :language: python

**Additional details:**

Async context manager doesn't implement ``__aenter__`` and ``__aexit__``. It can't be emitted when using Python < 3.5.


Created by the `async <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/async.py>`__ checker.