From patchwork Fri Oct 30 22:07:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 56722 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9UM82rW005732 for ; Fri, 30 Oct 2009 22:08:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757541AbZJ3WHz (ORCPT ); Fri, 30 Oct 2009 18:07:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757540AbZJ3WHz (ORCPT ); Fri, 30 Oct 2009 18:07:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26043 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757535AbZJ3WHz (ORCPT ); Fri, 30 Oct 2009 18:07:55 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9UM7mPT008043; Fri, 30 Oct 2009 18:07:48 -0400 Received: from localhost.localdomain (vpn-9-35.rdu.redhat.com [10.11.9.35]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9UM7kHf000921; Fri, 30 Oct 2009 18:07:47 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, ryanh@us.ibm.com, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Change the way subtests are loaded Date: Fri, 30 Oct 2009 20:07:45 -0200 Message-Id: <1256940465-5650-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py index 204164d..06ef9f5 100644 --- a/client/tests/kvm/kvm.py +++ b/client/tests/kvm/kvm.py @@ -22,9 +22,9 @@ class kvm(test.test): """ version = 1 def initialize(self): - # Make it possible to import modules from the test's bindir - sys.path.append(self.bindir) + # Make it possible to import modules from the subtest dir self.subtest_dir = os.path.join(self.bindir, 'tests') + sys.path.append(self.subtest_dir) def run_once(self, params): @@ -51,7 +51,7 @@ class kvm(test.test): raise error.TestError("No %s.py test file found" % type) # Load the tests directory (which was turned into a py module) try: - test_module = __import__("tests.%s" % type) + test_module = __import__(type) except ImportError, e: raise error.TestError("Failed to import test %s: %s" % (type, e)) @@ -60,7 +60,8 @@ class kvm(test.test): kvm_preprocessing.preprocess(self, params, env) kvm_utils.dump_env(env, env_filename) # Run the test function - eval("test_module.%s.run_%s(self, params, env)" % (type, type)) + run_func = getattr(test_module, "run_%s" % type) + run_func(self, params, env) kvm_utils.dump_env(env, env_filename) except Exception, e: