diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-06-02 18:48:31 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-06-02 18:48:31 +0200 |
commit | ed8bd56bc23923cdf6a8a32c3ea6a0d7646e85bd (patch) | |
tree | ae606b81816043aab17af364c277c6dcccbfd7f0 /test | |
parent | 26c38addde6ab7cf0c6c91b25071ceed472104d6 (diff) | |
download | firstaidkit-ed8bd56bc23923cdf6a8a32c3ea6a0d7646e85bd.tar.gz firstaidkit-ed8bd56bc23923cdf6a8a32c3ea6a0d7646e85bd.tar.xz firstaidkit-ed8bd56bc23923cdf6a8a32c3ea6a0d7646e85bd.zip |
Add the testsuite controler (test) and some tests.
Diffstat (limited to 'test')
-rwxr-xr-x | test | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -0,0 +1,49 @@ +#!/usr/bin/python -tt +# First Aid Kit - diagnostic and repair tool for Linux +# Copyright (C) 2008 Joel Granados <jgranado@redhat.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +import unittest, imp, sys +from testsuite import modnames +testloader = unittest.defaultTestLoader + +testsuitedir = "testsuite" +flawless = True + +for modname in modnames: + modinfo = imp.find_module(modname, [testsuitedir]) + modfile = open(modinfo[1], 'r') + modload = imp.load_module(modname, modfile, modinfo[1], modinfo[2]) + + result = unittest.TestResult() + suite = testloader.loadTestsFromModule(modload) + suite.run(result) + if len(result.failures) == 0 and len(result.errors) == 0: + # Nothing to worry about + continue + else: + flawless = False + if len(result.failures) > 0: + for failure in result.failures: + print failure + if len(result.errors) > 0: + for error in result.errors: + print error + +if flawless: + sys.exit(0) +else: + sys.exit(1) |