From dca259afc64647326af16d0dbe0e4c08993d90fb Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 9 Oct 2014 17:03:02 +0200 Subject: [PATCH] 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 --- ipatests/pytest.ini | 17 +++++++++++++++++ ipatests/setup.py.in | 2 ++ pytest.ini | 1 + 3 files changed, 20 insertions(+) create mode 120000 pytest.ini 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