tests/tools/conftest.py
changeset 1850 614396cbffbf
parent 1832 0f1081928d65
child 1881 091005ec69c4
--- a/tests/tools/conftest.py	Thu Oct 05 16:46:29 2017 +0300
+++ b/tests/tools/conftest.py	Fri Oct 06 17:52:34 2017 +0300
@@ -24,19 +24,25 @@
 
 import os
 import sys
-import time
 
-import pytest
-import xvfbwrapper
+# import pytest
+# import xvfbwrapper
 
-# append module root directory to sys.path
-sys.path.append(
-    os.path.abspath(
-        os.path.join(
-            os.path.dirname(__file__), '..', '..')
-    )
-)
 
+def init_environment():
+    """Append module root directory to sys.path"""
+    try:
+        import Beremiz as _Beremiz
+    except ImportError:
+        sys.path.append(
+            os.path.abspath(
+                os.path.join(
+                    os.path.dirname(__file__), '..', '..')
+            )
+        )
+
+
+init_environment()
 
 #
 # Something seems to be broken in Beremiz application,