4 # Copyright (C) 2012 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 """Script for testing qa.qa_config"""
26 from qa import qa_config
31 class TestTestEnabled(unittest.TestCase):
33 for name in ["test", ["foobar"], ["a", "b"]]:
34 self.assertTrue(qa_config.TestEnabled(name, _cfg={}))
36 for default in [False, True]:
37 self.assertFalse(qa_config.TestEnabled("foo", _cfg={
44 self.assertTrue(qa_config.TestEnabled("bar", _cfg={
51 def testEitherWithDefault(self):
52 names = qa_config.Either("one")
54 self.assertTrue(qa_config.TestEnabled(names, _cfg={
60 self.assertFalse(qa_config.TestEnabled(names, _cfg={
67 names = [qa_config.Either(["one", "two"]),
68 qa_config.Either("foo"),
72 self.assertTrue(qa_config.TestEnabled(names, _cfg={
78 self.assertFalse(qa_config.TestEnabled(names, _cfg={
84 for name in ["foo", "bar", "baz", "hello"]:
85 self.assertFalse(qa_config.TestEnabled(names, _cfg={
92 self.assertFalse(qa_config.TestEnabled(names, _cfg={
100 self.assertTrue(qa_config.TestEnabled(names, _cfg={
108 self.assertFalse(qa_config.TestEnabled(names, _cfg={
117 def testEitherNestedWithAnd(self):
118 names = qa_config.Either([["one", "two"], "foo"])
120 self.assertTrue(qa_config.TestEnabled(names, _cfg={
126 for name in ["one", "two"]:
127 self.assertFalse(qa_config.TestEnabled(names, _cfg={
136 if __name__ == "__main__":
137 testutils.GanetiTestProgram()