summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2017-01-05 19:29:22 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-12 11:17:54 +0100
commit68cb4d2b0f6b28f20513371e46b279d80c0b3070 (patch)
treecb45f58418f62b57744c7f25f4b07ef1c5d2cd9c
parent083b4241d287a731e2cf7fed5c61b30da52a8e37 (diff)
downloadfreeipa-68cb4d2b0f6b28f20513371e46b279d80c0b3070.tar.gz
freeipa-68cb4d2b0f6b28f20513371e46b279d80c0b3070.tar.xz
freeipa-68cb4d2b0f6b28f20513371e46b279d80c0b3070.zip
pytest: set rules to find test files and functions
1e06a5195bafe0224d77371987f2509f5508ca2f removed pytest.ini. Without the ini file, pytest 3.x has suboptimal settings and no longer picks up all test functions and test files. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Milan Kubik <mkubik@redhat.com>
-rw-r--r--ipatests/conftest.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/ipatests/conftest.py b/ipatests/conftest.py
index 45920de6d..6d8ba60c4 100644
--- a/ipatests/conftest.py
+++ b/ipatests/conftest.py
@@ -42,6 +42,12 @@ NO_RECURSE_DIRS = [
'install/share'
]
+INIVALUES = {
+ 'python_classes': ['test_', 'Test'],
+ 'python_files': ['test_*.py'],
+ 'python_functions': ['test_*'],
+}
+
def pytest_configure(config):
# add pytest markers
@@ -52,12 +58,10 @@ def pytest_configure(config):
for norecursedir in NO_RECURSE_DIRS:
config.addinivalue_line('norecursedirs', norecursedir)
- # load test classes with these prefixes.
- # addinivalue_line() adds duplicated entries.
- python_classes = config.getini('python_classes')
- for value in ['test_', 'Test']:
- if value not in python_classes:
- python_classes.append(value)
+ # addinivalue_line() adds duplicated entries and does not remove existing.
+ for name, values in INIVALUES.items():
+ current = config.getini(name)
+ current[:] = values
# set default JUnit prefix
if config.option.junitprefix is None: