From 89217a6557e16872ac1af0e305ac09886a9e1255 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 13 Oct 2014 16:30:38 -0500 Subject: Close files on server create, add tests The files opened for the --files and --user-data options were never closed, potentially leaking memory in a long-running client. Close them if they are file objects. Add a couple of basic tests for server create. Change-Id: I1658b0caa2d6af17308149cb52196ee28266ddf2 --- openstackclient/tests/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'openstackclient/tests/utils.py') diff --git a/openstackclient/tests/utils.py b/openstackclient/tests/utils.py index 38d47250..25f98525 100644 --- a/openstackclient/tests/utils.py +++ b/openstackclient/tests/utils.py @@ -23,6 +23,10 @@ import testtools from openstackclient.tests import fakes +class ParserException(Exception): + pass + + class TestCase(testtools.TestCase): def setUp(self): testtools.TestCase.setUp(self) @@ -84,7 +88,7 @@ class TestCommand(TestCase): try: parsed_args = cmd_parser.parse_args(args) except SystemExit: - raise Exception("Argument parse failed") + raise ParserException("Argument parse failed") for av in verify_args: attr, value = av if attr: -- cgit v1.2.1