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>
This commit is contained in:
Petr Viktorin
2014-10-09 17:03:02 +02:00
committed by Tomas Babej
parent 387b8b46b8
commit dca259afc6
3 changed files with 20 additions and 0 deletions

View File

@@ -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

View File

@@ -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'],

1
pytest.ini Symbolic link
View File

@@ -0,0 +1 @@
ipatests/pytest.ini