[SEBA-450] (part 2)
Add tox testing support on additional XOS library modules:
- xos-api
- xos-kafka (has no tests)
- xos-migrate (has no tests)
- xos-synchronizer
Change-Id: I98195bc9747971d3515882d517affe058dd86ac5
diff --git a/lib/xos-synchronizer/xossynchronizer/ansible_main.py b/lib/xos-synchronizer/xossynchronizer/ansible_main.py
index 08283a4..6a8c711 100644
--- a/lib/xos-synchronizer/xossynchronizer/ansible_main.py
+++ b/lib/xos-synchronizer/xossynchronizer/ansible_main.py
@@ -12,15 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
import os
import pickle
import sys
-
-# import json
import traceback
+
from xosconfig import Config
+try:
+ # Python 2: "reload" is built-in
+ reload # pylint: disable=reload-builtin
+except NameError:
+ from importlib import reload
+
sys.path.append("/opt/xos")
@@ -42,7 +48,7 @@
except KeyError:
pass
- import ansible_runner
+ from . import ansible_runner
reload(ansible_runner)
@@ -52,7 +58,7 @@
)
stats, aresults = runner.run()
- except Exception as e:
+ except Exception:
return {"stats": None, "aresults": None, "exception": traceback.format_exc()}
return {"stats": stats, "aresults": aresults}