Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
git+https://github.com/baztian/dbapi-compliance.git@ea7cb1b4#egg=dbapi-compliance
pyyaml >= 6.0.2
importlib-metadata >= 1.0 ; python_version < '3.8'
packaging >= 20.0
pylint == 3.3.0 ; python_version >= '3.9'
pylint == 3.2.7 ; python_version == '3.8'
pylint == 2.17.7 ; python_version == '3.7'
Expand Down
8 changes: 4 additions & 4 deletions test/suites/lib/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import functools
import sys

import pkg_resources
from .version import parse_version


def fetch_tarantool_version(self):
Expand Down Expand Up @@ -39,7 +39,7 @@ def skip_or_run_test_tarantool_impl(self, required_tt_version, msg):
"""
fetch_tarantool_version(self)

support_version = pkg_resources.parse_version(required_tt_version)
support_version = parse_version(required_tt_version)

if self.tnt_version < support_version:
self.skipTest(f'Tarantool {self.tnt_version} {msg}')
Expand Down Expand Up @@ -129,8 +129,8 @@ def wrapper(self, *args, **kwargs):

ver = sys.version_info
python_version_str = f'{ver.major}.{ver.minor}'
python_version = pkg_resources.parse_version(python_version_str)
support_version = pkg_resources.parse_version(required_python_version)
python_version = parse_version(python_version_str)
support_version = parse_version(required_python_version)
if python_version < support_version:
self.skipTest(f'Python {python_version} connector {msg}')

Expand Down
5 changes: 3 additions & 2 deletions test/suites/lib/tarantool_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import socket
import re

import pkg_resources
import yaml

from .version import parse_version


class TarantoolAdmin():
"""
Expand Down Expand Up @@ -104,6 +105,6 @@ def tnt_version(self):
r'[\d.]+', self.execute('box.info.version')[0]
).group()

self._tnt_version = pkg_resources.parse_version(raw_version)
self._tnt_version = parse_version(raw_version)

return self._tnt_version
5 changes: 5 additions & 0 deletions test/suites/lib/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
Version parsing helpers for tests.
"""

from packaging.version import parse as parse_version
4 changes: 2 additions & 2 deletions test/suites/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import unittest
import decimal

import pkg_resources
import msgpack

import tarantool
import tarantool.msgpack_ext.decimal as ext_decimal

from .lib.skip import skip_or_run_decimal_test, skip_or_run_varbinary_test
from .lib.tarantool_server import TarantoolServer
from .lib.version import parse_version
from .utils import assert_admin_success


Expand All @@ -37,7 +37,7 @@ def setUpClass(cls):
""")
assert_admin_success(resp)

if cls.srv.admin.tnt_version >= pkg_resources.parse_version('2.2.1'):
if cls.srv.admin.tnt_version >= parse_version('2.2.1'):
resp = cls.adm("""
box.schema.create_space('space_varbin', {if_not_exists = true})

Expand Down
4 changes: 2 additions & 2 deletions test/suites/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import sys
import unittest
import pkg_resources

import tarantool
from tarantool.error import DatabaseError

from .lib.skip import skip_or_run_varbinary_test, skip_or_run_error_extra_info_test
from .lib.tarantool_server import TarantoolServer
from .lib.version import parse_version
from .utils import assert_admin_success


Expand Down Expand Up @@ -53,7 +53,7 @@ def setUpClass(cls):
""")
assert_admin_success(resp)

if cls.srv.admin.tnt_version >= pkg_resources.parse_version('2.2.1'):
if cls.srv.admin.tnt_version >= parse_version('2.2.1'):
resp = cls.srv.admin("""
box.schema.create_space('space_varbin', {if_not_exists = true})
box.space['space_varbin']:format({
Expand Down
4 changes: 2 additions & 2 deletions test/suites/test_error_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import sys
import unittest
import pkg_resources

import msgpack

Expand All @@ -15,6 +14,7 @@

from .lib.tarantool_server import TarantoolServer
from .lib.skip import skip_or_run_error_ext_type_test
from .lib.version import parse_version
from .utils import assert_admin_success


Expand Down Expand Up @@ -55,7 +55,7 @@ def setUpClass(cls):
user='test', password='test',
encoding=None)

if cls.adm.tnt_version >= pkg_resources.parse_version('2.10.0'):
if cls.adm.tnt_version >= parse_version('2.10.0'):
cls.conn_encoding_utf8.eval(r"""
local err = box.error.new(box.error.UNKNOWN)
rawset(_G, 'simple_error', err)
Expand Down
5 changes: 2 additions & 3 deletions test/suites/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import unittest
import uuid

import pkg_resources

import tarantool
from tarantool.const import (
IPROTO_FEATURE_STREAMS,
Expand All @@ -24,6 +22,7 @@

from .lib.tarantool_server import TarantoolServer
from .lib.skip import skip_or_run_iproto_basic_features_test
from .lib.version import parse_version


class TestSuiteProtocol(unittest.TestCase):
Expand Down Expand Up @@ -86,7 +85,7 @@ def test_04_protocol(self):
# was introduced between 2.10.0-beta2 and 2.10.0-rc1 and reverted
# back to version 3 in the same version interval.
# Tarantool 2.10.3 still has version 3.
if self.adm.tnt_version >= pkg_resources.parse_version('2.10.0'):
if self.adm.tnt_version >= parse_version('2.10.0'):
self.assertTrue(self.con._protocol_version >= 3)
self.assertEqual(self.con._features[IPROTO_FEATURE_ERROR_EXTENSION], True)
else:
Expand Down
8 changes: 4 additions & 4 deletions test/suites/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import sys
import unittest
import pkg_resources

import tarantool
from tarantool.error import NotSupportedError

from .lib.tarantool_server import TarantoolServer
from .lib.skip import skip_or_run_constraints_test
from .lib.version import parse_version
from .utils import assert_admin_success


Expand Down Expand Up @@ -118,7 +118,7 @@ def setUpClass(cls):
end
""")

if cls.srv.admin.tnt_version >= pkg_resources.parse_version('2.10.0'):
if cls.srv.admin.tnt_version >= parse_version('2.10.0'):
resp = cls.srv.admin("""
box.schema.create_space(
'constr_tester_1', {
Expand Down Expand Up @@ -464,7 +464,7 @@ def test_07_schema_version_update(self):
def _run_test_schema_fetch_disable(self, con, mode=None):
# Enable SQL test case for tarantool 2.* and higher.
if int(str(self.srv.admin.tnt_version)[0]) > 1:
if self.srv.admin.tnt_version >= pkg_resources.parse_version('2.11.0'):
if self.srv.admin.tnt_version >= parse_version('2.11.0'):
# SEQSCAN keyword is explicitly allowing to use seqscan
# https://github.com/tarantool/tarantool/commit/77648827326ad268ec0ffbcd620c2371b65ef2b4
# It was introduced in 2.11.0-rc1. If compat.sql_seq_scan_default
Expand Down Expand Up @@ -612,7 +612,7 @@ def test_11_foreign_key_invalid_replace(self):
def tearDownClass(cls):
# We need to drop spaces with foreign keys with predetermined order,
# otherwise remote server clean() will fail to clean up resources.
if cls.srv.admin.tnt_version >= pkg_resources.parse_version('2.10.0'):
if cls.srv.admin.tnt_version >= parse_version('2.10.0'):
resp = cls.srv.admin("""
box.space.constr_tester_2:drop()
box.space.constr_tester_1:drop()
Expand Down
4 changes: 2 additions & 2 deletions test/suites/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import unittest
import uuid

import pkg_resources
import msgpack

import tarantool
Expand All @@ -16,6 +15,7 @@

from .lib.tarantool_server import TarantoolServer
from .lib.skip import skip_or_run_uuid_test
from .lib.version import parse_version
from .utils import assert_admin_success


Expand Down Expand Up @@ -47,7 +47,7 @@ def setUpClass(cls):
""")
assert_admin_success(resp)

if cls.srv.admin.tnt_version >= pkg_resources.parse_version('2.4.1'):
if cls.srv.admin.tnt_version >= parse_version('2.4.1'):
resp = cls.adm("""
box.schema.space.create('test_pk', {if_not_exists = true})
box.space['test_pk']:create_index('primary', {
Expand Down