public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues <lmr@redhat.com>
Subject: [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions
Date: Tue,  9 Jun 2009 13:33:27 -0300	[thread overview]
Message-ID: <1244565209-9132-2-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1244565209-9132-1-git-send-email-lmr@redhat.com>

Instead of resorting to internal autotest exception types, use
either python standard exceptions or an internally defined
ConfigError exception.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/kvm_config.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index a3467a0..cce931a 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -8,6 +8,11 @@ KVM configuration file utility functions.
 @copyright: Red Hat 2008-2009
 """
 
+
+class ConfigError(Exception):
+    pass
+
+
 class config:
     """
     Parse an input file or string that follows the KVM Test Config File format
@@ -47,7 +52,7 @@ class config:
             @param filename: Path of the configuration file.
         """
         if not os.path.exists(filename):
-            raise Exception, "File %s not found" % filename
+            raise IOError("File %s not found" % filename)
         self.filename = filename
         file = open(filename, "r")
         self.list = self.parse(file, self.list)
@@ -357,7 +362,7 @@ class config:
                 # (inside an exception or inside subvariants)
                 if restricted:
                     e_msg = "Using variants in this context is not allowed"
-                    raise error.AutotestError()
+                    raise ConfigError(e_msg)
                 if self.debug and not restricted:
                     self.__debug_print(indented_line,
                                      "Entering variants block (%d dicts in"
@@ -402,7 +407,7 @@ class config:
                                             words[1])
                     if not os.path.exists(filename):
                         e_msg = "Cannot include %s -- file not found" % filename
-                        raise error.AutotestError(e_msg)
+                        raise ConfigError(e_msg)
                     new_file = open(filename, "r")
                     list = self.parse(new_file, list, restricted)
                     new_file.close()
@@ -410,7 +415,7 @@ class config:
                         self.__debug_print("", "Leaving file %s" % words[1])
                 else:
                     e_msg = "Cannot include anything because no file is open"
-                    raise error.AutotestError(e_msg)
+                    raise ConfigError(e_msg)
 
             # Parse multi-line exceptions
             # (the block is parsed for each dict separately)
-- 
1.6.2.2


  reply	other threads:[~2009-06-09 16:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 16:33 [KVM-AUTOTEST PATCH 1/4] Make all programs on kvm test use /usr/bin/python Lucas Meneghel Rodrigues
2009-06-09 16:33 ` Lucas Meneghel Rodrigues [this message]
2009-06-09 16:33   ` [KVM-AUTOTEST PATCH 3/4] Fix bad line breaks Lucas Meneghel Rodrigues
2009-06-09 16:33     ` [KVM-AUTOTEST PATCH 4/4] Fix bad logging calls Lucas Meneghel Rodrigues
2009-06-10 12:32     ` [KVM-AUTOTEST PATCH 3/4] Fix bad line breaks Michael Goldish
2009-06-10 12:21   ` [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions Michael Goldish
2009-06-10 12:36     ` Michael Goldish
2009-06-09 17:00 ` [Autotest] [KVM-AUTOTEST PATCH 1/4] Make all programs on kvm test use /usr/bin/python Martin Bligh
2009-06-10  0:59   ` Lucas Meneghel Rodrigues
2009-06-10 11:01     ` Alexey Eromenko
2009-06-10 14:19       ` Martin Bligh
2009-06-15 13:35         ` Alexey Eromenko
2009-06-15 14:41           ` Lucas Meneghel Rodrigues
2009-06-15 15:58           ` Martin Bligh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244565209-9132-2-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox