Module: check_mk
Branch: master
Commit: 0bd2e83b7480b5e8b76d84e086319904cb368981
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0bd2e83b7480b5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 14 10:14:55 2016 +0200
tests: Fixed wrong mixup of import paths
---
tests/conftest.py | 10 ++++++++++
tests/testlib/pylint_cmk.py | 4 ----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index d6e1e9f..0b7af07 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
# This file initializes the py.test environment
import os
import sys
+import glob
import pytest
def cmk_path():
@@ -12,10 +13,19 @@ def cmc_path():
def add_python_paths():
+ # make python modules needed by Check_MK available. Hope it is sufficient to use
+ # the OMD default version here. Otherwise we would need to get cmk-omd git and
+ # load the modules from there.
+ # Maybe add a check for a default version matching the current branch.
+ sys.path = glob.glob("/omd/versions/default/lib/python/*.egg") \
+ + [ "/omd/versions/default/lib/python" ] \
+ + sys.path
+
# make the testlib available to the test modules
sys.path.insert(0, os.path.dirname(__file__))
# make the repo directory available (cmk lib)
sys.path.insert(0, cmk_path())
+
print("Import path: %s" % " ".join(sys.path))
diff --git a/tests/testlib/pylint_cmk.py b/tests/testlib/pylint_cmk.py
index 0ffec46..40e55c2 100644
--- a/tests/testlib/pylint_cmk.py
+++ b/tests/testlib/pylint_cmk.py
@@ -234,9 +234,5 @@ def verify_pylint_version():
def register(linter):
verify_pylint_version()
- sys.path = glob.glob("/omd/versions/default/lib/python/*.egg") \
- + [ "/omd/versions/default/lib/python" ] \
- + sys.path
-
linter.register_reporter(CMKColorizedTextReporter)
linter.register_reporter(CMKParseableTextReporter)