aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/testutils
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-07-04 16:27:38 +0200
committerGuido Günther <agx@sigxcpu.org>2016-07-04 20:34:53 +0200
commitf2ad919cb98b3e1b1a537e2a43ece88961006b29 (patch)
tree773d015715264a2bfd7c71091a2c2f539f9fde24 /tests/testutils
parent3b4912d70c576aeda70a9290d8e812029bc76a47 (diff)
tests: Check help of all rpm commands as well
Since we need to iterate over all commands in other tests we add a decorator.
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/data.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testutils/data.py b/tests/testutils/data.py
new file mode 100644
index 00000000..c9e233d7
--- /dev/null
+++ b/tests/testutils/data.py
@@ -0,0 +1,35 @@
+# vim: set fileencoding=utf-8 :
+#
+# (C) 2016 Guido Guenther <agx@sigxcpu.org>
+# 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, please see
+# <http://www.gnu.org/licenses/>
+
+from functools import wraps
+
+import unittest
+
+
+class TestCaseWithData(unittest.TestCase):
+ @staticmethod
+ def feed(data):
+ def wrapper(fn):
+ @wraps(fn)
+ def feed_item(self, *args):
+ for d in data:
+ try:
+ fn(self, *((d,) + args))
+ except self.failureException as e:
+ raise self.failureException(e.message + " with data %s" % repr(d))
+ return feed_item
+ return wrapper