summaryrefslogtreecommitdiffstats
path: root/ipatests/ipa-run-tests
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2017-01-03 18:04:53 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-05 17:37:02 +0100
commit1e06a5195bafe0224d77371987f2509f5508ca2f (patch)
tree2549212ed9b99ab0480fa6be5ecd31b4a3101a2f /ipatests/ipa-run-tests
parent3387734e6c6d47a756b5e914e7e515d2610a424f (diff)
downloadfreeipa-1e06a5195bafe0224d77371987f2509f5508ca2f.tar.gz
freeipa-1e06a5195bafe0224d77371987f2509f5508ca2f.tar.xz
freeipa-1e06a5195bafe0224d77371987f2509f5508ca2f.zip
Use pytest conftest.py and drop pytest.ini
Let's replace some ugly hacks with proper pytest conftest.py hooks. Test initialization of ipalib.api is now handled in pytest_cmdline_main(). Pytest plugins, markers and ignores are also moved into conftest.py. Additional guards make it possible to run tests without ipaserver installed. I added confcutdir to ensure that pytest does not leave our project space. Pytest used pytest.ini or setup.py before but pytest.ini is gone. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Milan Kubik <mkubik@redhat.com>
Diffstat (limited to 'ipatests/ipa-run-tests')
-rwxr-xr-xipatests/ipa-run-tests13
1 files changed, 8 insertions, 5 deletions
diff --git a/ipatests/ipa-run-tests b/ipatests/ipa-run-tests
index 53fa7b321..cafd993fd 100755
--- a/ipatests/ipa-run-tests
+++ b/ipatests/ipa-run-tests
@@ -34,12 +34,15 @@ import pytest
import ipatests
-# This must be set so ipalib.api gets initialized property for tests:
-os.environ['IPA_UNIT_TEST_MODE'] = 'cli_test'
-
# This is set to store --with-xunit report in an accessible place:
os.environ['IPATEST_XUNIT_PATH'] = os.path.join(os.getcwd(), 'nosetests.xml')
-os.chdir(os.path.dirname(ipatests.__file__))
+HERE = os.path.dirname(os.path.abspath(ipatests.__file__))
+
+args = sys.argv[1:]
+if not any('--confcutdir' in arg for arg in args):
+ args.insert(0, '--confcutdir={}'.format(HERE))
+
+os.chdir(HERE)
-sys.exit(pytest.main(sys.argv[1:]))
+sys.exit(pytest.main(args))