Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
revol.cai committed Feb 9, 2018
1 parent 3a45cca commit e124a44
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/

# C extensions
*.so
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

language: python
python:
- 3.6
- 3.5
- 3.4
- 2.7
Expand Down
4 changes: 3 additions & 1 deletion etcd3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-

"""Top-level package for etcd3-py."""
from __version__ import *
from .version import __version__, __author__, __email__

__all__ = [__version__, __author__, __email__]
9 changes: 1 addition & 8 deletions etcd3/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
from abc import abstractmethod, ABCMeta

import six


@six.add_metaclass(ABCMeta)
class BaseAPI(object):
@abstractmethod
def call_rpc(self, method, data=None, stream=False, **kwargs):
pass
raise NotImplementedError
6 changes: 3 additions & 3 deletions etcd3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests
from six.moves import urllib_parse

from __version__ import __version__
from version import __version__
from apis import BaseAPI
from errors import Etcd3Exception
from swagger_helper import SwaggerSpec
Expand All @@ -27,7 +27,7 @@ def iter_response(resp):
"""
buf = []
bracket_flag = 0
for c in resp.iter_content():
for c in resp.iter_content(chunk_size=1):
buf.append(c)
if c == '{':
bracket_flag += 1
Expand Down Expand Up @@ -121,7 +121,7 @@ def raise_for_status(resp):
return
try:
data = resp.json()
except:
except Exception:
_, _, tb = sys.exc_info()
error = ''.join(traceback.format_tb(tb))
code = -1
Expand Down
12 changes: 6 additions & 6 deletions etcd3/swagger_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

try:
import yaml
except:
except ImportError:
yaml = None


Expand Down Expand Up @@ -59,12 +59,12 @@ def __init__(self, spec):
else:
try:
self.spec = json.loads(spec_content)
except:
except Exception:
if not yaml:
raise ImportError("No module named yaml")
try:
self.spec = yaml.safe_load(spec_content)
except:
except Exception:
raise ValueError("Fail to load spec")

@functools32.lru_cache()
Expand Down Expand Up @@ -233,7 +233,7 @@ def init(this, data):
this._node = self
this._data = data
for k in self.properties._keys():
if not k in data:
if k not in data:
continue
v = data[k]
m = self.properties._get(k)
Expand Down Expand Up @@ -352,8 +352,8 @@ def _get(self, k, *args, **kwargs):
__getitem__ = _get

def __dir__(self):
return [k for k in type(self).__dict__.keys() if not k.startswith('__')] \
+ [_format_path(k) for k in self._node.keys()]
return [k for k in type(self).__dict__.keys() if not k.startswith('__')] + \
[_format_path(k) for k in self._node.keys()]

def __contains__(self, item):
return item in self._node
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tag = True
search = version='{current_version}'
replace = {new_version}

[bumpversion:file:etcd3/__version__.py]
[bumpversion:file:etcd3/version.py]
search = __version__ = '{current_version}'
replace = {new_version}

Expand Down
8 changes: 7 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tox]
envlist = py27, py34, py35, flake8
envlist = py27, py34, py35, py36, flake8

[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27
Expand All @@ -13,9 +14,14 @@ basepython=python
deps=flake8
commands=flake8 etcd3

[flake8]
ignore=E501,E731

[testenv]
setenv =
PYTHONPATH = {toxinidir}
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
deps =
-r{toxinidir}/requirements_dev.txt
commands =
Expand Down

0 comments on commit e124a44

Please sign in to comment.