summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-05-22 11:08:10 +0200
committerMartin Kosek <mkosek@redhat.com>2013-06-17 19:22:58 +0200
commite87807d3797ad8154b78b8741a4541326c9ca12f (patch)
treed26b1583e59fb18025897db6d528757b14aa1cc3
parentc60142efda817f030a7495cd6fe4a19953e55afa (diff)
downloadfreeipa-e87807d3797ad8154b78b8741a4541326c9ca12f.tar.gz
freeipa-e87807d3797ad8154b78b8741a4541326c9ca12f.tar.xz
freeipa-e87807d3797ad8154b78b8741a4541326c9ca12f.zip
Add ipa-run-tests command
Part of the work for: https://fedorahosted.org/freeipa/ticket/3654
-rw-r--r--freeipa.spec.in1
-rwxr-xr-xipatests/ipa-run-tests37
-rw-r--r--ipatests/setup.py.in1
3 files changed, 39 insertions, 0 deletions
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 7b74eb0d7..239811ac2 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -814,6 +814,7 @@ fi
%dir %{python_sitelib}/ipatests/test_ipaserver/install
%dir %{python_sitelib}/ipatests/test_pkcs10
%dir %{python_sitelib}/ipatests/test_xmlrpc
+%{_bindir}/ipa-run-tests
%{python_sitelib}/ipatests-*.egg-info
%endif # ! %{ONLY_CLIENT}
diff --git a/ipatests/ipa-run-tests b/ipatests/ipa-run-tests
new file mode 100755
index 000000000..872b15e9c
--- /dev/null
+++ b/ipatests/ipa-run-tests
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+"""Nose wrapper for running an installed (not in-tree) IPA test suite
+
+Any command-line arguments are passed directly to Nose.
+Note that any relative paths given will be based on the ipatests module's path
+"""
+
+import sys
+import os
+from os import path
+
+import ipatests
+
+nose = '/usr/bin/nosetests'
+
+cmd = [
+ nose,
+ '-v',
+ '--with-doctest',
+ '--doctest-tests',
+ '--exclude=plugins',
+ '--where', os.path.dirname(ipatests.__file__),
+]
+cmd += sys.argv[1:]
+
+
+# This must be set so ipalib.api gets initialized property for tests:
+os.environ['IPA_UNIT_TEST_MODE'] = 'cli_test'
+
+
+if not path.isfile(nose):
+ print 'ERROR: need %r' % nose
+ sys.exit(100)
+
+print ' '.join(cmd)
+sys.exit(call(cmd))
diff --git a/ipatests/setup.py.in b/ipatests/setup.py.in
index 2517651db..4e0b1aa00 100644
--- a/ipatests/setup.py.in
+++ b/ipatests/setup.py.in
@@ -74,6 +74,7 @@ def setup_package():
"ipatests.test_ipaserver.install",
"ipatests.test_pkcs10",
"ipatests.test_xmlrpc"],
+ scripts=['ipa-run-tests'],
package_data = {
'ipatests.test_install': ['*.update'],
'ipatests.test_pkcs10': ['*.csr']}