[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/modelaccessor.py b/lib/xos-synchronizer/xossynchronizer/modelaccessor.py
index 72fc3c5..b4b26f3 100644
--- a/lib/xos-synchronizer/xossynchronizer/modelaccessor.py
+++ b/lib/xos-synchronizer/xossynchronizer/modelaccessor.py
@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 """ ModelAccessor
 
     A class for abstracting access to models. Used to get any djangoisms out
@@ -23,24 +22,28 @@
     models into the calling module's scope.
 """
 
+from __future__ import absolute_import
+
 import functools
 import importlib
 import os
 import signal
 import sys
 from threading import Timer
-from loadmodels import ModelLoadClient
 
 from xosconfig import Config
-from multistructlog import create_logger
 from xosutil.autodiscover_version import autodiscover_version_of_main
 
+from .loadmodels import ModelLoadClient
+
+from multistructlog import create_logger
 log = create_logger(Config().get("logging"))
 
 after_reactor_exit_code = None
 orig_sigint = None
 model_accessor = None
 
+
 class ModelAccessor(object):
     def __init__(self):
         self.all_model_classes = self.get_all_model_classes()
@@ -161,6 +164,7 @@
 
     reactor.callLater(1, functools.partial(keep_trying, client, reactor))
 
+
 def unload_models(client, reactor, version):
     # This function is called by a timer until it succeeds.
     log.info("unload_models initiated by timer")
@@ -180,13 +184,14 @@
         if result.status == result.TRYAGAIN:
             log.info("TRYAGAIN received. Expect to try again in 30 seconds.")
 
-    except Exception as e:
+    except Exception:
         # If the synchronizer is operational, then assume the ORM's restart_on_disconnect will deal with the
         # connection being lost.
         log.exception("Error while unloading. Expect to try again in 30 seconds.")
 
     Timer(30, functools.partial(unload_models, client, reactor, version)).start()
 
+
 def exit_while_inside_reactor(reactor, code):
     """ Calling sys.exit() while inside reactor ends up trapped by reactor.
 
@@ -261,7 +266,6 @@
                 exit_while_inside_reactor(reactor, 1)
                 return
 
-
             log.exception("failed to onboard models")
             # If it's some other error, then we don't need to force a reconnect. Just try the LoadModels() again.
             reactor.callLater(10, functools.partial(grpcapi_reconnect, client, reactor))
@@ -279,7 +283,7 @@
 
     client.xos_orm.restart_on_disconnect = True
 
-    from apiaccessor import CoreApiModelAccessor
+    from .apiaccessor import CoreApiModelAccessor
 
     model_accessor = CoreApiModelAccessor(orm=client.xos_orm)
 
@@ -370,7 +374,7 @@
     global model_accessor
 
     # the mock model accessor always gets built to a temporary location
-    if not "/tmp/mock_modelaccessor" in sys.path:
+    if "/tmp/mock_modelaccessor" not in sys.path:
         sys.path.append("/tmp/mock_modelaccessor")
 
     from mock_modelaccessor import model_accessor as mock_model_accessor