summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorevasquez <eric.vasquez@calxeda.com>2013-08-27 10:21:57 -0500
committerevasquez <eric.vasquez@calxeda.com>2013-08-27 10:21:57 -0500
commitdc3901471d18178d92bfa4bacadb0b2fce28ae3d (patch)
tree5f8b478eddfa9d261d8689d55111ca49f0383867
parentd1a1f42b1e725bcc6604912c688f7b38f65c02d6 (diff)
downloadcxmanage-dc3901471d18178d92bfa4bacadb0b2fce28ae3d.tar.gz
nojira: restore exception export. pylint fixes
-rw-r--r--cxmanage_api/cx_exceptions.py10
-rw-r--r--cxmanage_test/image_test.py10
-rw-r--r--cxmanage_test/tasks_test.py12
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
@@ -33,6 +33,16 @@
#
+# 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):