From dc3901471d18178d92bfa4bacadb0b2fce28ae3d Mon Sep 17 00:00:00 2001 From: evasquez Date: Tue, 27 Aug 2013 10:21:57 -0500 Subject: nojira: restore exception export. pylint fixes --- cxmanage_api/cx_exceptions.py | 10 ++++++++++ cxmanage_test/image_test.py | 10 ++++++++-- cxmanage_test/tasks_test.py | 12 +++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/cxmanage_api/cx_exceptions.py b/cxmanage_api/cx_exceptions.py index d924fe9..df2dcc7 100644 --- a/cxmanage_api/cx_exceptions.py +++ b/cxmanage_api/cx_exceptions.py @@ -32,6 +32,16 @@ # DAMAGE. +# +# We expose these here so a user does not have to import from pyipmi or tftpy. +# +# pylint: disable=W0611 +# +from pyipmi import IpmiError + +from tftpy.TftpShared import TftpException + + # # Defines the custom exceptions used by the cxmanage_api project. # diff --git a/cxmanage_test/image_test.py b/cxmanage_test/image_test.py index 609aa5b..fcbb011 100644 --- a/cxmanage_test/image_test.py +++ b/cxmanage_test/image_test.py @@ -1,3 +1,6 @@ +"""Calxeda: image_test.py""" + + # Copyright (c) 2012, Calxeda Inc. # # All rights reserved. @@ -39,6 +42,8 @@ from cxmanage_api.tftp import InternalTftp from cxmanage_test import random_file, TestImage + +# pylint: disable=R0904 class ImageTest(unittest.TestCase): """ Tests involving cxmanage images @@ -72,13 +77,14 @@ class ImageTest(unittest.TestCase): self.assertEqual(header.daddr, daddr) self.assertEqual(simg[header.imgoff:], contents) - def test_multiple_uploads(self): + @staticmethod + def test_multiple_uploads(): """ Test to make sure FDs are being closed """ # Create image filename = random_file(1024) image = TestImage(filename, "RAW") - for x in xrange(2048): + for _ in xrange(2048): image.render_to_simg(0, 0) os.remove(filename) diff --git a/cxmanage_test/tasks_test.py b/cxmanage_test/tasks_test.py index a936b06..5ede9e4 100644 --- a/cxmanage_test/tasks_test.py +++ b/cxmanage_test/tasks_test.py @@ -1,3 +1,6 @@ +"""Calxeda: task_test.py""" + + # Copyright (c) 2012, Calxeda Inc. # # All rights reserved. @@ -28,16 +31,21 @@ # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. + import unittest import time from cxmanage_api.tasks import TaskQueue + +# pylint: disable=R0904 class TaskTest(unittest.TestCase): + """Test for the TaskQueue Class.""" + def test_task_queue(self): """ Test the task queue """ task_queue = TaskQueue() - counters = [Counter() for x in xrange(128)] + counters = [Counter() for _ in xrange(128)] tasks = [task_queue.put(counters[i].add, i) for i in xrange(128)] for task in tasks: @@ -61,6 +69,8 @@ class TaskTest(unittest.TestCase): self.assertGreaterEqual(finish - start, 2.0) + +# pylint: disable=R0903 class Counter(object): """ Simple counter object for testing purposes """ def __init__(self): -- cgit v1.2.1