summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc/xmlrpc_test.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2014-10-10 09:47:25 +0200
committerTomas Babej <tbabej@redhat.com>2014-11-21 12:14:44 +0100
commit0cb12f3cdef899df47e749ddaef937f7d1bd7a91 (patch)
treed2dce9d096511170c7a4b3daf90b4b1d36532094 /ipatests/test_xmlrpc/xmlrpc_test.py
parent07def0b275ea5ff0f7db7627189f3494588e7046 (diff)
downloadfreeipa-0cb12f3cdef899df47e749ddaef937f7d1bd7a91.tar.gz
freeipa-0cb12f3cdef899df47e749ddaef937f7d1bd7a91.tar.xz
freeipa-0cb12f3cdef899df47e749ddaef937f7d1bd7a91.zip
Declarative tests: Switch to pytest
Provide a local pytest plugin to generate tests. The Declarative tests can now only be run with pytest https://fedorahosted.org/freeipa/ticket/4610 Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc/xmlrpc_test.py')
-rw-r--r--ipatests/test_xmlrpc/xmlrpc_test.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py
index ee6d55e17..03c5b5bd6 100644
--- a/ipatests/test_xmlrpc/xmlrpc_test.py
+++ b/ipatests/test_xmlrpc/xmlrpc_test.py
@@ -278,27 +278,15 @@ class Declarative(XMLRPC_test):
print e
pass
- def test_generator(self):
- """
- Iterate through tests.
+ def test_command(self, index, declarative_test_definition):
+ """Run an individual test
- nose reports each one as a seperate test.
+ The arguments are provided by the pytest plugin.
"""
- name = self.__class__.__name__
- for (i, test) in enumerate(self.tests):
- if callable(test):
- func = lambda: test(self)
- nice = '%s[%d]: call %s: %s' % (
- name, i, test.__name__, test.__doc__
- )
- func.description = nice
- else:
- nice = '%s[%d]: %s: %s' % (
- name, i, test['command'][0], test.get('desc', '')
- )
- func = lambda: self.check(nice, **test)
- func.description = nice
- yield (func,)
+ if callable(declarative_test_definition):
+ declarative_test_definition(self)
+ else:
+ self.check(**declarative_test_definition)
def check(self, nice, desc, command, expected, extra_check=None):
(cmd, args, options) = command