From 0a076826c0288e3d0dec1177eff12164e251a201 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 25 Apr 2013 17:47:00 +0200 Subject: [PATCH] Sync requirements with openstack-common/requirements Allow prettytable 0.7.x specifically. Add testcase. Remove setuptools_git from test-requires, already part of setup_require Change-Id: If0d114cc6ec0f84ea75d798adb5ebc424605b22e --- tests/test_utils.py | 52 +++++++++++++++++++++++++++++++++++++++++++++ tools/pip-requires | 5 +++-- tools/test-requires | 8 +++---- 3 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 tests/test_utils.py diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 00000000..b17b496a --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,52 @@ +# Copyright 2013 OpenStack LLC. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +import cStringIO +import sys +import unittest2 + +from ceilometerclient.common import utils + + +class UtilsTest(unittest2.TestCase): + + def test_prettytable(self): + class Struct: + def __init__(self, **entries): + self.__dict__.update(entries) + + # test that the prettytable output is wellformatted (left-aligned) + columns = ['ID', 'Name'] + val = ['Name1', 'another', 'veeeery long'] + images = [Struct(**{'id': i ** 16, 'name': val[i]}) + for i in range(len(val))] + + saved_stdout = sys.stdout + try: + sys.stdout = output_dict = cStringIO.StringIO() + utils.print_dict({'K': 'k', 'Key': 'Value'}) + + finally: + sys.stdout = saved_stdout + + self.assertEqual(output_dict.getvalue(), '''\ ++----------+-------+ +| Property | Value | ++----------+-------+ +| K | k | +| Key | Value | ++----------+-------+ +''') diff --git a/tools/pip-requires b/tools/pip-requires index 632d17be..f3314cb7 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -1,5 +1,6 @@ +# This file is managed by openstack-depends argparse -prettytable>=0.6,<0.7 -python-keystoneclient>=0.1.2 httplib2 iso8601>=0.1.4 +prettytable>=0.6,<0.8 +python-keystoneclient>=0.2,<0.3 diff --git a/tools/test-requires b/tools/test-requires index 9f9f13ab..54b19cc3 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,11 +1,11 @@ +# This file is managed by openstack-depends distribute>=0.6.24 -mox +mox>=0.5.3 nose nose-exclude +nosehtmloutput>=0.0.3 nosexcover -openstack.nose_plugin -nosehtmloutput +openstack.nose_plugin>=0.7 pep8==1.3.3 -setuptools-git>=0.4 sphinx>=1.1.2 unittest2