Skip to content

Commit f8a0d8e

Browse files
committed
Added unit tests for dbapi module
used dbapi-compliance package to test module according to pep-249 specification removed EOL python 3.4 from appveyor test used installer.sh from tarantool.io to set up Tarantool 2.4 version in test.sh
1 parent d992c24 commit f8a0d8e

File tree

4 files changed

+102
-8
lines changed

4 files changed

+102
-8
lines changed

Diff for: appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ install:
2121
# install runtime dependencies
2222
- "%PYTHON%\\python.exe -m pip install -r requirements.txt"
2323
# install testing dependencies
24-
- "%PYTHON%\\python.exe -m pip install pyyaml%PYYAML%"
24+
- "%PYTHON%\\python.exe -m pip install pyyaml%PYYAML% dbapi-compliance==1.15.0"
2525

2626
build: off
2727

Diff for: test.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
set -exu # Strict shell (w/o -o pipefail)
44

55
# Install tarantool.
6-
curl http://download.tarantool.org/tarantool/2x/gpgkey | sudo apt-key add -
7-
release=`lsb_release -c -s`
8-
echo "deb http://download.tarantool.org/tarantool/2x/ubuntu/ ${release} main" | sudo tee /etc/apt/sources.list.d/tarantool_2x.list
9-
sudo apt-get update > /dev/null
10-
sudo apt-get -q -y install tarantool
6+
curl -L https://tarantool.io/installer.sh | VER=2.4 sudo -E bash
117

128
# Install testing dependencies.
139
pip install -r requirements.txt
14-
pip install pyyaml
10+
pip install pyyaml dbapi-compliance==1.15.0
1511

1612
# Run tests.
1713
python setup.py test

Diff for: unit/suites/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
from .test_protocol import TestSuite_Protocol
1010
from .test_reconnect import TestSuite_Reconnect
1111
from .test_mesh import TestSuite_Mesh
12+
from .test_dbapi import TestSuite_DBAPI
1213

1314
test_cases = (TestSuite_Schema, TestSuite_Request, TestSuite_Protocol,
14-
TestSuite_Reconnect, TestSuite_Mesh)
15+
TestSuite_Reconnect, TestSuite_Mesh, TestSuite_DBAPI)
1516

1617
def load_tests(loader, tests, pattern):
1718
suite = unittest.TestSuite()

Diff for: unit/suites/test_dbapi.py

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from __future__ import print_function
4+
5+
import sys
6+
import unittest
7+
8+
import dbapi20
9+
10+
import tarantool
11+
from tarantool.dbapi import Connection
12+
from .lib.tarantool_server import TarantoolServer
13+
14+
15+
class TestSuite_DBAPI(dbapi20.DatabaseAPI20Test):
16+
table_prefix = 'dbapi20test_' # If you need to specify a prefix for tables
17+
18+
ddl1 = 'create table %sbooze (name varchar(20) primary key)' % table_prefix
19+
ddl2 = 'create table %sbarflys (name varchar(20) primary key, ' \
20+
'drink varchar(30))' % table_prefix
21+
22+
@classmethod
23+
def setUpClass(self):
24+
print(' DBAPI '.center(70, '='), file=sys.stderr)
25+
print('-' * 70, file=sys.stderr)
26+
self.srv = TarantoolServer()
27+
self.srv.script = 'unit/suites/box.lua'
28+
self.srv.start()
29+
self.con = tarantool.Connection(self.srv.host, self.srv.args['primary'])
30+
self.driver = Connection(self.srv.host, self.srv.args['primary'])
31+
32+
def setUp(self):
33+
# prevent a remote tarantool from clean our session
34+
if self.srv.is_started():
35+
self.srv.touch_lock()
36+
self.con.flush_schema()
37+
38+
# grant full access to guest
39+
self.srv.admin("box.schema.user.grant('guest', 'create,read,write,"
40+
"execute', 'universe')")
41+
42+
@classmethod
43+
def tearDownClass(self):
44+
self.con.close()
45+
self.srv.stop()
46+
self.srv.clean()
47+
48+
@unittest.skip('Not implemented')
49+
def test_Binary(self):
50+
pass
51+
52+
@unittest.skip('Not implemented')
53+
def test_STRING(self):
54+
pass
55+
56+
@unittest.skip('Not implemented')
57+
def test_BINARY(self):
58+
pass
59+
60+
@unittest.skip('Not implemented')
61+
def test_NUMBER(self):
62+
pass
63+
64+
@unittest.skip('Not implemented')
65+
def test_DATETIME(self):
66+
pass
67+
68+
@unittest.skip('Not implemented')
69+
def test_ROWID(self):
70+
pass
71+
72+
@unittest.skip('Not implemented')
73+
def test_Date(self):
74+
pass
75+
76+
@unittest.skip('Not implemented')
77+
def test_Time(self):
78+
pass
79+
80+
@unittest.skip('Not implemented')
81+
def test_Timestamp(self):
82+
pass
83+
84+
@unittest.skip('Not implemented as optional.')
85+
def test_nextset(self):
86+
pass
87+
88+
@unittest.skip('To do')
89+
def test_callproc(self):
90+
pass
91+
92+
def test_setoutputsize(self): # Do nothing
93+
pass
94+
95+
@unittest.skip('To do')
96+
def test_description(self):
97+
pass

0 commit comments

Comments
 (0)