summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2014-10-09 17:03:02 +0200
committerTomas Babej <tbabej@redhat.com>2014-11-21 12:14:44 +0100
commitdca259afc64647326af16d0dbe0e4c08993d90fb (patch)
tree98afcf81621fe3c96713b715bb984658c00f1109
parent387b8b46b874f2b3be67226665f2fd89ed342690 (diff)
Configure pytest to run doctests
The pytest.ini file needs to be in or above the directory py.test is called in. When in IPA project root, this invocation will find ./ipatests/pytest.ini: py.test ipatests/ but these will not (they're equivalent): py.test . py.test So pytest.ini must be in the project root. However, setupttols can't include files outside package directories, so we also need this file to be under ipatests/ Solve the problem by symlinking ./pytest.ini to ipatests/pytest.ini. https://fedorahosted.org/freeipa/ticket/4610 Reviewed-By: Tomas Babej <tbabej@redhat.com>
-rw-r--r--ipatests/pytest.ini17
-rw-r--r--ipatests/setup.py.in2
l---------pytest.ini1
3 files changed, 20 insertions, 0 deletions
diff --git a/ipatests/pytest.ini b/ipatests/pytest.ini
index d2355d961..ed462c37a 100644
--- a/ipatests/pytest.ini
+++ b/ipatests/pytest.ini
@@ -1,2 +1,19 @@
+# pytest configuration
+
+# This file lives in ipatests/pytest.ini, so it can be included by setup.py,
+# and it's symlinked from the project's root directory, so py.test finds it
+# when called with no arguments.
+
[pytest]
python_classes = test_ Test
+addopts = --doctest-modules
+ # Ignore files for doc tests.
+ # TODO: ideally, these should all use __name__=='__main__' guards
+ --ignore=setup.py
+ --ignore=setup-client.py
+ --ignore=checks/check-ra.py
+ --ignore=daemons/ipa-otpd/test.py
+ --ignore=doc/examples/python-api.py
+ --ignore=install/share/copy-schema-to-ca.py
+ --ignore=install/share/wsgi.py
+ --ignore=ipapython/py_default_encoding/setup.py
diff --git a/ipatests/setup.py.in b/ipatests/setup.py.in
index 7f041465c..658a330d8 100644
--- a/ipatests/setup.py.in
+++ b/ipatests/setup.py.in
@@ -66,6 +66,7 @@ def setup_package():
classifiers=filter(None, CLASSIFIERS.split('\n')),
package_dir = {'ipatests': ''},
packages = ["ipatests",
+ "ipatests.pytest_plugins",
"ipatests.test_cmdline",
"ipatests.test_install",
"ipatests.test_integration",
@@ -78,6 +79,7 @@ def setup_package():
"ipatests.test_xmlrpc"],
scripts=['ipa-run-tests', 'ipa-test-config', 'ipa-test-task'],
package_data = {
+ 'ipatests': ['pytest.ini'],
'ipatests.test_install': ['*.update'],
'ipatests.test_integration': ['scripts/*'],
'ipatests.test_pkcs10': ['*.csr'],
diff --git a/pytest.ini b/pytest.ini
new file mode 120000
index 000000000..e87991b0f
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1 @@
+ipatests/pytest.ini \ No newline at end of file