From cf0a82fa174b5eaf669df797dcfb40b7a4d118e5 Mon Sep 17 00:00:00 2001 From: Yuval Shalev Date: Thu, 15 Dec 2016 00:06:37 +0200 Subject: [PATCH] added travis and tox for testing --- .gitignore | 6 ++++-- .travis.yml | 13 +++++++++++++ redlock/cli.py | 7 +++++-- setup.py | 5 ++--- tox.ini | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 .travis.yml create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 5742569..dfd19db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .coverage .DS_Store -redlock_py.egg-info +redlock_py.egg-info/ dist __pycache__ -.cache +.cache/ +.idea/ +.tox/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..61faa85 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python + +python: + - 3.5 + +install: + - pip install tox + +services: + - redis-server + +script: +- tox \ No newline at end of file diff --git a/redlock/cli.py b/redlock/cli.py index 44e6003..9a083c8 100644 --- a/redlock/cli.py +++ b/redlock/cli.py @@ -65,8 +65,10 @@ def main(): 2 if there was an error with the options 3 if there was an error communicating with Redis (eg. socket timeout) """)) - parser.add_argument("--redis", action="append", default=None, help="Redis URL (eg. redis://localhost:6379/0", metavar="URL") - parser.add_argument("--quiet", action="store_true", default=False, help="No stderr output, just a return code (and key for lock action)") + parser.add_argument("--redis", action="append", default=None, + help="Redis URL (eg. redis://localhost:6379/0", metavar="URL") + parser.add_argument("--quiet", action="store_true", default=False, + help="No stderr output, just a return code (and key for lock action)") subparsers = parser.add_subparsers(help='See command help via `%(prog)s --help`') parser_lock = subparsers.add_parser('lock', help='Acquire a lock', description=""" @@ -94,5 +96,6 @@ def main(): sys.exit(result) + if __name__ == "__main__": main() diff --git a/setup.py b/setup.py index 2d585c4..f47c62c 100644 --- a/setup.py +++ b/setup.py @@ -77,12 +77,11 @@ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4' + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5' ], author='pjdecoursey@spscommerce.com', author_email='webapps@spscommerce.com', diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4f72ec2 --- /dev/null +++ b/tox.ini @@ -0,0 +1,19 @@ +[tox] +envlist = py27, py33, py34, py35, flake8 + +[flake8] +max-line-length = 120 + +[testenv] +passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH +deps = + redis + pytest-cov + coveralls +commands = + py.test --cov {envsitepackagesdir}/redlock tests + coveralls + +[testenv:flake8] +deps = flake8 +commands = flake8