From 8bb129d4214478664bcb3d9466315f409b3f5fa9 Mon Sep 17 00:00:00 2001 From: Maxime Vidori Date: Thu, 28 Apr 2016 16:30:01 +0200 Subject: [PATCH] Remove uneeded test deps, fix some little issues Change-Id: I85d25a766eb2c8130038f1ca2775fff8c458d2fb --- dci/common/schemas.py | 9 ++++----- test-requirements.txt | 4 ---- tests/common/test_schemas.py | 6 ++++-- tox.ini | 4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dci/common/schemas.py b/dci/common/schemas.py index af9c755a8..e9b3f5e75 100644 --- a/dci/common/schemas.py +++ b/dci/common/schemas.py @@ -114,16 +114,15 @@ def schema_factory(schema): # # ############################################################################### -split = lambda string: string.split(',') - +split_coerce = v.Coerce(lambda s: s.split(',')) args = Schema({ v.Optional('limit', default=None): v.All(v.Coerce(int), v.Range(0), msg=INVALID_LIMIT), v.Optional('offset', default=None): v.All(v.Coerce(int), v.Range(0), msg=INVALID_OFFSET), - v.Optional('sort', default=[]): v.Coerce(split), - v.Optional('where', default=[]): v.Coerce(split), - v.Optional('embed', default=[]): v.Coerce(split) + v.Optional('sort', default=[]): split_coerce, + v.Optional('where', default=[]): split_coerce, + v.Optional('embed', default=[]): split_coerce }, extra=v.REMOVE_EXTRA) ############################################################################### diff --git a/test-requirements.txt b/test-requirements.txt index 75bf49be6..9596705b0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,3 @@ flake8==2.4.1 -pep8==1.5.7 -mccabe==0.2.1 -hacking>=0.10.1 pytest>=2.6.2 pytest-cov>=1.8.0 -pytest-xdist diff --git a/tests/common/test_schemas.py b/tests/common/test_schemas.py index 17012d00b..f9ccd92f6 100644 --- a/tests/common/test_schemas.py +++ b/tests/common/test_schemas.py @@ -450,8 +450,10 @@ def generate_invalids_and_errors(): invalids = dict([utils.INVALID_NAME, utils.INVALID_JOB_STATE] + invalids) - errors = dict([utils.INVALID_NAME_ERROR, utils.INVALID_JOB_STATE_ERROR] - + errors) + errors = dict( + [utils.INVALID_NAME_ERROR, utils.INVALID_JOB_STATE_ERROR] + + errors + ) return invalids, errors def test_post_extra_data(self): diff --git a/tox.ini b/tox.ini index 87c9ea740..c75da0fd4 100644 --- a/tox.ini +++ b/tox.ini @@ -16,13 +16,13 @@ whitelist_externals = commands = sh ./scripts/start_db.sh sh ./scripts/start_es.sh - py.test -v {posargs: --cov-report html --cov dci/server tests} + py.test -v {posargs: --cov-report html --cov dci tests} [testenv:pep8] commands = flake8 [flake8] -ignore = H405,H304,H104 +ignore = H405,H304,H104,E402 exclude=.venv,.git,.tox,dist,*egg,*.egg-info,build,examples,doc show-source = True