The asynch.Connection class get more unburden: now its parse_dsn() method is moved aside into the standalone util function. The reasons are as follows: 1) having DSN parsing logic in one place that may be used not only by the asynch.Connection class instances; 2) it can be tested "per se", not needing the asynch.Connection class being instantiated first.
The asynch.Connection class can support the interface of an asynchronous context manager: no more necessity for making an end-user invoking the connect() method and remember to call the close() method for resource clean-up.
the asynch.Connection gets a semi-implicit created state (status). It can be seen as the result of calling the __repr__() method on a created connection (cn = Connection(...) which were not neither opened nor closed. When created, if the cn.closed is False, then we can falsely assume that it was closed somewhere before which can be not this case. The same reasoning when the cn.connected is False - was it connected before or not? But when created and cn.connected and cn.closed are None, we understand that the connection were neither opened nor closed. For more details, please see the PR #106 .
Other non-critical feature:
the minimum pytest version is 7.4.4 or higher. The minimum version is 7.4 to be used with Python3.9.
The tests were run under the Python v3.9, however the .python-version file is added into the .gitignore file because the project is expected to be run in multiple virtual environments. Apart introducing the mypy package, intoxicating the project with the tox testing tool would be nice, but in one of the next PRs.
This PR entails the PR #106 .
The features brought:
asynch.Connection
class get more unburden: now itsparse_dsn()
method is moved aside into the standalone util function. The reasons are as follows: 1) having DSN parsing logic in one place that may be used not only by theasynch.Connection
class instances; 2) it can be tested "per se", not needing theasynch.Connection
class being instantiated first.asynch.Connection
class can support the interface of an asynchronous context manager: no more necessity for making an end-user invoking theconnect()
method and remember to call theclose()
method for resource clean-up.asynch.Connection
gets a semi-implicitcreated
state (status). It can be seen as the result of calling the__repr__()
method on a created connection (cn = Connection(...)
which were not neither opened nor closed. When created, if thecn.closed
is False, then we can falsely assume that it was closed somewhere before which can be not this case. The same reasoning when thecn.connected
is False - was it connected before or not? But when created andcn.connected
andcn.closed
are None, we understand that the connection were neither opened nor closed. For more details, please see the PR #106 .Other non-critical feature:
The tests were run under the Python v3.9, however the
.python-version
file is added into the.gitignore
file because the project is expected to be run in multiple virtual environments. Apart introducing themypy
package, intoxicating the project with thetox
testing tool would be nice, but in one of the next PRs.