From 27a0e270e36eaf5352f7df31ab99ea2b78aa2eb9 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Mon, 12 Aug 2013 10:21:09 +1000 Subject: [PATCH] updates for tests --- .gitignore | 8 +++++++- requirements.txt | 1 + setup.cfg | 31 +++++++++++++++++++++++++++++++ setup.py | 27 ++++----------------------- tox.ini | 31 +++++++++++++++++++++++++++---- turbo_hipster/lib/utils.py | 4 ++-- 6 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 14621f7..0c41fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,10 @@ *.sql .tox .venv -.testrepository \ No newline at end of file +.testrepository +.test +AUTHORS +build/* +ChangeLog +doc/build/* +dist/ diff --git a/requirements.txt b/requirements.txt index e69de29..3f47798 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +gear diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9d7f6b3 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,31 @@ +[metadata] +name = turbo-hipster +summary = A set of CI tools for openstack +description-file = README.md +author = Rackspace Australia +author-email = joshua.hesketh@rackspace.com +classifier = + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 2.6 + +[pbr] +warnerrors = True + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[entry_points] +console_scripts = + worker_server = turbo_hipster.worker_server:main + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 diff --git a/setup.py b/setup.py index 1925002..f72fb68 100755 --- a/setup.py +++ b/setup.py @@ -15,27 +15,8 @@ # under the License. -import os -from setuptools import setup +import setuptools -# Utility function to read the README file. -# Used for the long_description. It's nice, because now 1) we have a top level -# README file and 2) it's easier to type in the README file than to put a raw -# string in below ... -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -setup( - name = "turbo-hipster", - version = "0.0.1", - author = "Joshua Hesketh", - author_email = "josh@nitrotech.org", - description = ("A set of CI tools for openstack."), - license = "GPLv2", - keywords = "", - url = "https://github.com/rcbau/turbo-hipster", - packages=['turbo_hipster', 'tests'], - long_description=read('README.md'), - classifiers=[ - ], -) +setuptools.setup( + setup_requires=['d2to1', 'pbr'], + d2to1=True) diff --git a/tox.ini b/tox.ini index e4d4147..14d2d9c 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27, py33 +envlist = pep8, pyflakes, py26, py27, py33 [testenv] sitepackages = True @@ -12,7 +12,30 @@ setenv = VIRTUAL_ENV={envdir} LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=C -deps = -U - -r{toxinidir}/requirements.txt +deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = {envpython} setup.py test \ No newline at end of file +commands = + python setup.py testr --slowest --testr-args='{posargs}' + +[tox:jenkins] +downloadcache = ~/cache/pip + +[testenv:pep8] +commands = flake8 + +[testenv:cover] +commands = + python setup.py testr --coverage + +[testenv:pyflakes] +deps = pyflakes + -r{toxinidir}/requirements.txt +commands = pyflakes turbo-hipster setup.py + +[testenv:venv] +commands = {posargs} + +[flake8] +ignore = E125,H +show-source = True +exclude = .venv,.tox,dist,doc,build,*.egg diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py index 55a0d22..a693ff7 100644 --- a/turbo_hipster/lib/utils.py +++ b/turbo_hipster/lib/utils.py @@ -184,12 +184,12 @@ def push_file(job_name, file_path, publish_config): def swift_push_file(job_name, file_path, swift_config): """ Push a log file to a swift server. """ with open(file_path, 'r') as fd: - name = filename + name = job_name + '_' + os.path.basename(file_path) con = swiftclient.client.Connection(swift_config['authurl'], swift_config['user'], swift_config['apikey']) obj = con.put_object(swift_config['container'], name, fd) - return con.get_object(swift_config['container'], name) + return obj def local_push_file(job_name, file_path, local_config):