Skip to content

Commit

Permalink
Get rid of YAML dependency (partly, still left in tests)
Browse files Browse the repository at this point in the history
closes gh-90
  • Loading branch information
bigbes committed May 23, 2017
1 parent 6c2f495 commit 39c9097
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,5 +1,5 @@
test:
python setup.py test
pytest
coverage:
python -m coverage run -p --source=. setup.py test
cov-html:
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
@@ -1,2 +1 @@
msgpack-python>=0.4.0
pyyaml>=3.10
11 changes: 5 additions & 6 deletions setup.py
Expand Up @@ -38,11 +38,11 @@

# Test runner
# python setup.py test
try:
from tests.setup_command import test
cmdclass["test"] = test
except ImportError:
pass
# try:
# from tests.setup_command import test
# cmdclass["test"] = test
# except ImportError:
# pass


def read(*parts):
Expand Down Expand Up @@ -83,6 +83,5 @@ def find_version(*file_paths):
command_options=command_options,
install_requires=[
'msgpack-python>=0.4',
'PyYAML>=3.10',
]
)
13 changes: 9 additions & 4 deletions tarantool/response.py
Expand Up @@ -3,7 +3,7 @@

import collections

import yaml
import json
import msgpack

from tarantool.const import (
Expand Down Expand Up @@ -221,12 +221,17 @@ def __str__(self):
:rtype: str or None
'''
if self.return_code:
return yaml.dump({
return json.dumps({
'error': {
'code': self.strerror[0],
'reason': self.return_message
}
})
return yaml.dump(self._data)
}, sort_keys = True, indent = 4)
output = []
for tpl in self._data:
output.extend(("- ", json.dumps(tpl), "\n"))
if len(output) > 0:
output.pop()
return ''.join(output)

__repr__ = __str__
5 changes: 1 addition & 4 deletions tests/setup_command.py
Expand Up @@ -5,7 +5,6 @@
import unittest
import setuptools


from glob import glob

class test(setuptools.Command):
Expand All @@ -22,9 +21,7 @@ def run(self):
'''
Find all tests in test/tarantool/ and run them
'''
#root = os.path.dirname(os.path.dirname(__file__))
#sys.path.insert(0, root)


tests = unittest.defaultTestLoader.discover('tests')
test_runner = unittest.TextTestRunner(verbosity = 2)
test_runner.run(tests)
3 changes: 1 addition & 2 deletions tests/suites/test_dml.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

import yaml
import unittest
import tarantool

Expand Down Expand Up @@ -61,7 +60,7 @@ def test_00_02_fill_space(self):
[i, i%5, 'tuple_'+str(i)]
)
def test_00_03_answer_repr(self):
repr_str = """- [1, 1, tuple_1]\n"""
repr_str = """- [1, 1, "tuple_1"]"""
self.assertEqual(repr(self.con.select('space_1', 1)), repr_str)

def test_02_select(self):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Expand Up @@ -7,8 +7,8 @@
envlist = py27, py36, pypy

[testenv]
commands = python setup.py test
commands = pytest
deps =
pyyaml>=3.10
msgpack-python>=0.4.0
six
pytest>=3.0.0

0 comments on commit 39c9097

Please sign in to comment.