Skip to content

Commit 39c9097

Browse files
committed
Get rid of YAML dependency (partly, still left in tests)
closes tarantoolgh-90
1 parent 6c2f495 commit 39c9097

File tree

7 files changed

+19
-20
lines changed

7 files changed

+19
-20
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test:
2-
python setup.py test
2+
pytest
33
coverage:
44
python -m coverage run -p --source=. setup.py test
55
cov-html:

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
msgpack-python>=0.4.0
2-
pyyaml>=3.10

setup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838

3939
# Test runner
4040
# python setup.py test
41-
try:
42-
from tests.setup_command import test
43-
cmdclass["test"] = test
44-
except ImportError:
45-
pass
41+
# try:
42+
# from tests.setup_command import test
43+
# cmdclass["test"] = test
44+
# except ImportError:
45+
# pass
4646

4747

4848
def read(*parts):
@@ -83,6 +83,5 @@ def find_version(*file_paths):
8383
command_options=command_options,
8484
install_requires=[
8585
'msgpack-python>=0.4',
86-
'PyYAML>=3.10',
8786
]
8887
)

tarantool/response.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import collections
55

6-
import yaml
6+
import json
77
import msgpack
88

99
from tarantool.const import (
@@ -221,12 +221,17 @@ def __str__(self):
221221
:rtype: str or None
222222
'''
223223
if self.return_code:
224-
return yaml.dump({
224+
return json.dumps({
225225
'error': {
226226
'code': self.strerror[0],
227227
'reason': self.return_message
228228
}
229-
})
230-
return yaml.dump(self._data)
229+
}, sort_keys = True, indent = 4)
230+
output = []
231+
for tpl in self._data:
232+
output.extend(("- ", json.dumps(tpl), "\n"))
233+
if len(output) > 0:
234+
output.pop()
235+
return ''.join(output)
231236

232237
__repr__ = __str__

tests/setup_command.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import unittest
66
import setuptools
77

8-
98
from glob import glob
109

1110
class test(setuptools.Command):
@@ -22,9 +21,7 @@ def run(self):
2221
'''
2322
Find all tests in test/tarantool/ and run them
2423
'''
25-
#root = os.path.dirname(os.path.dirname(__file__))
26-
#sys.path.insert(0, root)
27-
24+
2825
tests = unittest.defaultTestLoader.discover('tests')
2926
test_runner = unittest.TextTestRunner(verbosity = 2)
3027
test_runner.run(tests)

tests/suites/test_dml.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
import yaml
43
import unittest
54
import tarantool
65

@@ -61,7 +60,7 @@ def test_00_02_fill_space(self):
6160
[i, i%5, 'tuple_'+str(i)]
6261
)
6362
def test_00_03_answer_repr(self):
64-
repr_str = """- [1, 1, tuple_1]\n"""
63+
repr_str = """- [1, 1, "tuple_1"]"""
6564
self.assertEqual(repr(self.con.select('space_1', 1)), repr_str)
6665

6766
def test_02_select(self):

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
envlist = py27, py36, pypy
88

99
[testenv]
10-
commands = python setup.py test
10+
commands = pytest
1111
deps =
1212
pyyaml>=3.10
1313
msgpack-python>=0.4.0
14-
six
14+
pytest>=3.0.0

0 commit comments

Comments
 (0)