tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Fix unittest warnings #251

Closed DifferentialOrange closed 1 year ago

DifferentialOrange commented 1 year ago

api: make connection close idempotent

After this patch, it is possible to call conn.close() method multiple times.

Part of #250

test: replace deprecated methods

assertRaisesRegexp and assertEquals were renamed in version 3.2 [1].

  1. https://docs.python.org/3/library/unittest.html#deprecated-aliases

Part of #250

test: fix server resource warnings

Fix several ResourceWarning messages related to test Tarantool server methods not cleaning up sockets.

Part of #250

test: fix unix socket test resource warnings

hasattr check actually has no effect for unittest runtime-added fields, so both server and connection for unix socket test weren't closed after run.

Part of #250

test: fix test connection resource warnings

Close all connection opened in tests even in case of failed asserts.

Part of #250

test: fix dbapi test connection resource warnings

DBAPI2 compliance tests are not implemented here but inherited from external module [1]. Two tests from this module open a connection and forget to close it. The issue [2] had been fixed and PR had been merged, but there is no tagged release yet.

  1. https://pypi.org/project/dbapi-compliance/
  2. https://github.com/baztian/dbapi-compliance/issues/5

Part of #250

test: filter warnings for disabled instances

There are several ConnectionPool tests that stop some pool instances and verify that everything works fine even for semi-functional cluster. Different network and cluster state warning are issued in this case. They are expected and not informative, thus it is better to filter them in final output.

Closes #250

DifferentialOrange commented 1 year ago

image Oh, well, maybe it's worth to wait until a release

DifferentialOrange commented 1 year ago

image Oh, well, maybe it's worth to wait until a release

Install package from master commit for tests