You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/02/05 17:51:22 UTC

incubator-ariatosca git commit: tests fixin

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-42-Generic-ctx-serialization-mechanism bbee7baf4 -> 0e94bfc88


tests fixin


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/0e94bfc8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0e94bfc8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0e94bfc8

Branch: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism
Commit: 0e94bfc88c7b23e781ee6efd2b138519cfacaec1
Parents: bbee7ba
Author: mxmrlv <mx...@gmail.com>
Authored: Sun Feb 5 19:51:10 2017 +0200
Committer: mxmrlv <mx...@gmail.com>
Committed: Sun Feb 5 19:51:10 2017 +0200

----------------------------------------------------------------------
 aria/__init__.py                                |  8 +--
 aria/orchestrator/context/serialization.py      | 12 ++---
 aria/orchestrator/runner.py                     |  8 +--
 aria/storage/api.py                             |  7 +++
 aria/storage/core.py                            |  8 +--
 aria/storage/sql_mapi.py                        | 55 +++++++++-----------
 setup.py                                        |  2 +-
 tests/mock/context.py                           |  6 +--
 tests/orchestrator/context/test_operation.py    |  7 ++-
 .../context/test_resource_render.py             |  3 +-
 tests/orchestrator/context/test_serialize.py    |  7 ++-
 tests/orchestrator/context/test_toolbelt.py     |  4 +-
 tests/orchestrator/context/test_workflow.py     |  3 +-
 .../orchestrator/execution_plugin/test_local.py |  5 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  5 +-
 tests/orchestrator/workflows/api/test_task.py   |  4 +-
 .../workflows/builtin/test_execute_operation.py |  3 +-
 .../orchestrator/workflows/builtin/test_heal.py |  2 +-
 .../workflows/builtin/test_install.py           |  3 +-
 .../workflows/builtin/test_uninstall.py         |  3 +-
 .../orchestrator/workflows/core/test_engine.py  |  4 +-
 tests/orchestrator/workflows/core/test_task.py  |  4 +-
 .../test_task_graph_into_exececution_graph.py   |  4 +-
 .../workflows/executor/test_process_executor.py |  3 +-
 .../executor/test_process_executor_extension.py |  3 +-
 .../test_process_executor_tracked_changes.py    |  3 +-
 tests/storage/__init__.py                       | 29 -----------
 tests/storage/test_instrumentation.py           |  3 +-
 tests/storage/test_model_storage.py             |  7 ++-
 tests/storage/test_models.py                    |  5 +-
 tests/storage/test_structures.py                |  8 +--
 tests/utils/test_plugin.py                      |  3 +-
 32 files changed, 103 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/__init__.py
----------------------------------------------------------------------
diff --git a/aria/__init__.py b/aria/__init__.py
index 37cec1a..48e4f00 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -57,7 +57,7 @@ def install_aria_extensions():
     extension.init()
 
 
-def application_model_storage(api, driver_kwargs=None):
+def application_model_storage(api, api_kwargs=None):
     """
     Initiate model storage
     """
@@ -79,12 +79,12 @@ def application_model_storage(api, driver_kwargs=None):
         storage.model.Task,
     ]
     # if api not in _model_storage:
-    return storage.ModelStorage(api, items=models, driver_kwargs=driver_kwargs or {})
+    return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
 
 
-def application_resource_storage(api, driver_kwargs=None):
+def application_resource_storage(api, api_kwargs=None):
     """
     Initiate resource storage
     """
     return storage.ResourceStorage(
-        api, driver_kwargs=driver_kwargs or {}, items=['blueprint', 'deployment', 'plugin', ])
+        api, api_kwargs=api_kwargs or {}, items=['blueprint', 'deployment', 'plugin', ])

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/orchestrator/context/serialization.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/serialization.py b/aria/orchestrator/context/serialization.py
index c583a71..b2f1e97 100644
--- a/aria/orchestrator/context/serialization.py
+++ b/aria/orchestrator/context/serialization.py
@@ -29,7 +29,7 @@ def operation_context_to_dict(context):
         model = context.model
         context_dict['model_storage'] = {
             'api_cls': model.api,
-            'driver_kwargs': model._driver_kwargs,
+            'api_kwargs': model._api_kwargs,
         }
     else:
         context_dict['model_storage'] = None
@@ -37,7 +37,7 @@ def operation_context_to_dict(context):
         resource = context.resource
         context_dict['resource_storage'] = {
             'api_cls': resource.api,
-            'driver_kwargs': resource._driver_kwargs
+            'api_kwargs': resource._api_kwargs
         }
     else:
         context_dict['resource_storage'] = None
@@ -54,15 +54,15 @@ def operation_context_from_dict(context_dict):
     model_storage = context['model_storage']
     if model_storage:
         api_cls = model_storage['api_cls']
-        driver_kwargs = model_storage['driver_kwargs']
+        api_kwargs = model_storage['api_kwargs']
         context['model_storage'] = aria.application_model_storage(
-            api_cls, driver_kwargs=driver_kwargs)
+            api_cls, api_kwargs=api_kwargs)
 
     resource_storage = context['resource_storage']
     if resource_storage:
         api_cls = resource_storage['api_cls']
-        driver_kwargs = resource_storage['driver_kwargs']
+        api_kwargs = resource_storage['api_kwargs']
         context['resource_storage'] = aria.application_resource_storage(
-             api=api_cls, driver_kwargs=driver_kwargs)
+             api=api_cls, api_kwargs=api_kwargs)
 
     return context_cls(**context)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/orchestrator/runner.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/runner.py b/aria/orchestrator/runner.py
index b571b34..7892d67 100644
--- a/aria/orchestrator/runner.py
+++ b/aria/orchestrator/runner.py
@@ -118,15 +118,11 @@ class Runner(object):
 
         # Storage
         sqlite_kwargs = dict(engine=sqlite_engine, session=sqlite_session)
-        return application_model_storage(
-            SQLAlchemyModelAPI,
-            driver_kwargs=sqlite_kwargs)
+        return application_model_storage(SQLAlchemyModelAPI, api_kwargs=sqlite_kwargs)
 
     def create_fs_resource_storage(self, directory='.'): # pylint: disable=no-self-use
         fs_kwargs = dict(directory=directory)
-        return application_resource_storage(
-            FileSystemResourceAPI,
-            api_kwargs=fs_kwargs)
+        return application_resource_storage(FileSystemResourceAPI, api_kwargs=fs_kwargs)
 
     def cleanup(self):
         if self._is_storage_temporary \

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/storage/api.py
----------------------------------------------------------------------
diff --git a/aria/storage/api.py b/aria/storage/api.py
index d6fc3b8..adf3198 100644
--- a/aria/storage/api.py
+++ b/aria/storage/api.py
@@ -15,6 +15,7 @@
 """
 General storage API
 """
+from functools import partial
 
 
 class StorageAPI(object):
@@ -29,6 +30,12 @@ class StorageAPI(object):
         """
         raise NotImplementedError('Subclass must implement abstract create method')
 
+    @classmethod
+    def storage_initiator(cls, func=None):
+        if func is None:
+            return partial(cls.storage_initiator, cls=cls)
+        init = cls.__init__
+        cls.__init__ = lambda self, *args, **kwargs: init(self, **func(cls=cls, *args, **kwargs))
 
 class ModelAPI(StorageAPI):
     """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/storage/core.py
----------------------------------------------------------------------
diff --git a/aria/storage/core.py b/aria/storage/core.py
index d46afaa..94b4fe0 100644
--- a/aria/storage/core.py
+++ b/aria/storage/core.py
@@ -52,10 +52,10 @@ class Storage(LoggerMixin):
     """
     Represents the storage
     """
-    def __init__(self, api_cls, driver_kwargs=None, items=(), **kwargs):
+    def __init__(self, api_cls, api_kwargs=None, items=(), **kwargs):
         super(Storage, self).__init__(**kwargs)
         self.api = api_cls
-        self._driver_kwargs = driver_kwargs or {}
+        self._api_kwargs = api_kwargs or {}
         self.registered = {}
         for item in items:
             self.register(item)
@@ -90,7 +90,7 @@ class ResourceStorage(Storage):
         :param name:
         :return:
         """
-        self.registered[name] = self.api(name=name, **self._driver_kwargs)
+        self.registered[name] = self.api(name=name, **self._api_kwargs)
         self.registered[name].create()
         self.logger.debug('setup {name} in storage {self!r}'.format(name=name, self=self))
 
@@ -112,7 +112,7 @@ class ModelStorage(Storage):
             return
         self.registered[model_name] = self.api(name=model_name,
                                                model_cls=model_cls,
-                                               **self._driver_kwargs)
+                                               **self._api_kwargs)
         self.registered[model_name].create()
         self.logger.debug('setup {name} in storage {self!r}'.format(name=model_name, self=self))
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/aria/storage/sql_mapi.py
----------------------------------------------------------------------
diff --git a/aria/storage/sql_mapi.py b/aria/storage/sql_mapi.py
index f4e0b4f..ed993fa 100644
--- a/aria/storage/sql_mapi.py
+++ b/aria/storage/sql_mapi.py
@@ -25,13 +25,12 @@ from sqlalchemy import pool
 from sqlalchemy.exc import SQLAlchemyError
 
 from aria.utils.collections import OrderedDict
-from aria.storage import (
+from . import (
     api,
-    exceptions
+    exceptions,
 )
 
 
-
 class SQLAlchemyModelAPI(api.ModelAPI):
     """
     SQL based MAPI.
@@ -371,34 +370,30 @@ class SQLAlchemyModelAPI(api.ModelAPI):
             getattr(instance, rel.key)
 
 
-def register_initiator(func, cls=None):
-    cls.__metadata__ = type('{0}Metaclas'.format(cls.__name__),
-                            (type, ),
-                            dict(__call__=func))
-
+@SQLAlchemyModelAPI.storage_initiator
+def init_storage(cls, base_dir=None, filename='db.sqlite', **kwargs):
+    if not hasattr(cls, '_engine'):
+        if base_dir is not None:
+            uri = 'sqlite:///{platform_char}{path}'.format(
+                # Handles the windows behavior where there is not root, but drivers.
+                # Thus behaving as relative path.
+                platform_char='' if 'Windows' in platform.system() else '/',
 
-@register_initiator(cls=SQLAlchemyModelAPI)
-def init_storage(cls, base_dir=None, filename='db.sqlite', *args, **kwargs):
-        if not hasattr(cls, '_engine'):
-            if base_dir is not None:
-                uri = 'sqlite:///{platform_char}{path}'.format(
-                    # Handles the windows behavior where there is not root, but drivers.
-                    # Thus behaving as relative path.
-                    platform_char='' if 'Windows' in platform.system() else '/',
-
-                    path=os.path.join(base_dir, filename))
-                engine_kwargs = {}
-            else:
-                uri = 'sqlite:///:memory:'
-                engine_kwargs = dict(connect_args={'check_same_thread': False},
-                                     poolclass=pool.StaticPool)
-
-            cls._engine = create_engine(uri, **engine_kwargs)
-            session_factory = orm.sessionmaker(bind=cls._engine)
-            cls._session = orm.scoped_session(session_factory=session_factory) if base_dir else \
-                session_factory()
-
-        return type.__call__(cls, engine=cls._engine, session=cls._session, *args, **kwargs)
+                path=os.path.join(base_dir, filename))
+            engine_kwargs = {}
+        else:
+            uri = 'sqlite:///:memory:'
+            engine_kwargs = dict(connect_args={'check_same_thread': False},
+                                 poolclass=pool.StaticPool)
+
+        cls._engine = create_engine(uri, **engine_kwargs)
+        session_factory = orm.sessionmaker(bind=cls._engine)
+        cls._session = orm.scoped_session(session_factory=session_factory) if base_dir else \
+            session_factory()
+
+    return_dict = dict(engine=cls._engine, session=cls._session)
+    return_dict.update(kwargs)
+    return return_dict
 
 
 class ListResult(object):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 2d1106d..7a1a3f4 100644
--- a/setup.py
+++ b/setup.py
@@ -64,7 +64,7 @@ console_scripts = ['aria = aria.cli.cli:main']
 
 class InstallCommand(install):
     user_options = install.user_options + [
-        ('skip-ctx', None, 'Install with or without the ctx (Defaults to False')
+        ('skip-ctx', None, 'Install with or without the ctx (Defaults to False)')
     ]
     boolean_options = install.boolean_options + ['skip-ctx']
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/mock/context.py
----------------------------------------------------------------------
diff --git a/tests/mock/context.py b/tests/mock/context.py
index 4fbae14..0f8ae41 100644
--- a/tests/mock/context.py
+++ b/tests/mock/context.py
@@ -22,12 +22,12 @@ from . import models
 from .topology import create_simple_topology_two_nodes
 
 
-def simple(model_driver_kwargs=None, resources_driver_kwargs=None, context_kwargs=None):
+def simple(tmpdir, model_driver_kwargs=None, resources_driver_kwargs=None, context_kwargs=None):
     model_storage = aria.application_model_storage(
-        SQLAlchemyModelAPI, driver_kwargs=model_driver_kwargs or {})
+        SQLAlchemyModelAPI, api_kwargs=model_driver_kwargs or {})
 
     resource_storage = aria.application_resource_storage(
-        FileSystemResourceAPI, driver_kwargs=resources_driver_kwargs or {})
+        FileSystemResourceAPI, api_kwargs=resources_driver_kwargs or dict(directory=str(tmpdir)))
 
     deployment_id = create_simple_topology_two_nodes(model_storage)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/context/test_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_operation.py b/tests/orchestrator/context/test_operation.py
index b0918d1..1b84390 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -37,8 +37,11 @@ global_test_holder = {}
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)),
-                                  workdir=str(tmpdir.join('workdir')))
+    context = mock.context.simple(
+        str(tmpdir.join('workdir')),
+        model_driver_kwargs=dict(base_dir=str(tmpdir)),
+        context_kwargs=dict(workdir=str(tmpdir.join('workdir')))
+    )
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/context/test_resource_render.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_resource_render.py b/tests/orchestrator/context/test_resource_render.py
index a5e4fa8..467e941 100644
--- a/tests/orchestrator/context/test_resource_render.py
+++ b/tests/orchestrator/context/test_resource_render.py
@@ -53,8 +53,7 @@ def test_download_resource_and_render_provided_variables(tmpdir, ctx):
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(),
-                                  resources_driver_kwargs=str(tmpdir.join('resources')))
+    context = mock.context.simple(str(tmpdir).join('resources'))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/context/test_serialize.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_serialize.py b/tests/orchestrator/context/test_serialize.py
index 8d4cb1f..e881266 100644
--- a/tests/orchestrator/context/test_serialize.py
+++ b/tests/orchestrator/context/test_serialize.py
@@ -89,9 +89,9 @@ def executor():
 @pytest.fixture
 def context(tmpdir):
     result = mock.context.simple(
+        str(tmpdir).join('resources'),
         model_driver_kwargs=dict(base_dir=str(tmpdir)),
-        resources_driver_kwargs=dict(directory=str(tmpdir.join('resources'))),
-        context_kwargs=dict(workdir=str(tmpdir.join('workdir')))
+        context_kwargs=dict(workdir=str(tmpdir).join('workdir'))
     )
 
     yield result
@@ -100,7 +100,6 @@ def context(tmpdir):
 
 @pytest.fixture
 def memory_model_storage():
-    result = aria.application_model_storage(
-        SQLAlchemyModelAPI, driver_kwargs=storage.get_sqlite_api_kwargs())
+    result = aria.application_model_storage(SQLAlchemyModelAPI)
     yield result
     storage.release_sqlite_storage(result)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/context/test_toolbelt.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_toolbelt.py b/tests/orchestrator/context/test_toolbelt.py
index b63811b..6f83d1e 100644
--- a/tests/orchestrator/context/test_toolbelt.py
+++ b/tests/orchestrator/context/test_toolbelt.py
@@ -33,7 +33,9 @@ global_test_holder = {}
 
 @pytest.fixture
 def workflow_context(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(
+        str(tmpdir),
+        model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/context/test_workflow.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_workflow.py b/tests/orchestrator/context/test_workflow.py
index 13e7639..7ae7c1b 100644
--- a/tests/orchestrator/context/test_workflow.py
+++ b/tests/orchestrator/context/test_workflow.py
@@ -60,8 +60,7 @@ class TestWorkflowContext(object):
 
 @pytest.fixture(scope='function')
 def storage():
-    api_kwargs = test_storage.get_sqlite_api_kwargs()
-    workflow_storage = application_model_storage(SQLAlchemyModelAPI, driver_kwargs=api_kwargs)
+    workflow_storage = application_model_storage(SQLAlchemyModelAPI)
     workflow_storage.blueprint.put(models.get_blueprint())
     blueprint = workflow_storage.blueprint.get_by_name(models.BLUEPRINT_NAME)
     workflow_storage.deployment.put(models.get_deployment(blueprint))

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/execution_plugin/test_local.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_local.py b/tests/orchestrator/execution_plugin/test_local.py
index 30447e2..f308071 100644
--- a/tests/orchestrator/execution_plugin/test_local.py
+++ b/tests/orchestrator/execution_plugin/test_local.py
@@ -36,6 +36,7 @@ from tests.orchestrator.workflows.helpers import events_collector
 IS_WINDOWS = os.name == 'nt'
 
 
+@pytest.mark.skip("debugging...")
 class TestLocalRunScript(object):
 
     def test_script_path_parameter(self, executor, workflow_context, tmpdir):
@@ -504,8 +505,8 @@ if __name__ == '__main__':
     @pytest.fixture
     def workflow_context(self, tmpdir):
         workflow_context = mock.context.simple(
-            storage.get_sqlite_api_kwargs(str(tmpdir)),
-            resources_driver_kwargs=str(tmpdir.join('resources')))
+            str(tmpdir.join('resources')),
+            model_driver_kwargs=dict(base_dir=str(tmpdir)))
         workflow_context.states = []
         workflow_context.exception = None
         yield workflow_context

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/execution_plugin/test_ssh.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py
index 5d21ca4..3caf48a 100644
--- a/tests/orchestrator/execution_plugin/test_ssh.py
+++ b/tests/orchestrator/execution_plugin/test_ssh.py
@@ -265,9 +265,8 @@ class TestWithActualSSHServer(object):
 
     @pytest.fixture
     def workflow_context(self, tmpdir):
-        workflow_context = mock.context.simple(
-            storage.get_sqlite_api_kwargs(str(tmpdir)),
-            resources_driver_kwargs=str(tmpdir.join('resources')))
+        workflow_context = mock.context.simple(str(tmpdir).join('resources'),
+            model_driver_kwargs=dict(base_dir=str(tmpdir)))
         workflow_context.states = []
         workflow_context.exception = None
         yield workflow_context

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/api/test_task.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py
index 601c437..433c763 100644
--- a/tests/orchestrator/workflows/api/test_task.py
+++ b/tests/orchestrator/workflows/api/test_task.py
@@ -24,13 +24,13 @@ from tests import mock, storage
 
 
 @pytest.fixture
-def ctx():
+def ctx(tmpdir):
     """
     Create the following graph in storage:
     dependency_node <------ dependent_node
     :return:
     """
-    simple_context = mock.context.simple(storage.get_sqlite_api_kwargs())
+    simple_context = mock.context.simple(tmpdir)
     simple_context.model.execution.put(mock.models.get_execution(simple_context.deployment))
     yield simple_context
     storage.release_sqlite_storage(simple_context.model)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/builtin/test_execute_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_execute_operation.py b/tests/orchestrator/workflows/builtin/test_execute_operation.py
index b7e5678..4ad614a 100644
--- a/tests/orchestrator/workflows/builtin/test_execute_operation.py
+++ b/tests/orchestrator/workflows/builtin/test_execute_operation.py
@@ -24,7 +24,8 @@ from tests import storage
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(str(tmpdir),
+                                  model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/builtin/test_heal.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_heal.py b/tests/orchestrator/workflows/builtin/test_heal.py
index b470790..b78b555 100644
--- a/tests/orchestrator/workflows/builtin/test_heal.py
+++ b/tests/orchestrator/workflows/builtin/test_heal.py
@@ -26,7 +26,7 @@ from . import (assert_node_install_operations,
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/builtin/test_install.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_install.py b/tests/orchestrator/workflows/builtin/test_install.py
index 789a161..dc425b3 100644
--- a/tests/orchestrator/workflows/builtin/test_install.py
+++ b/tests/orchestrator/workflows/builtin/test_install.py
@@ -25,7 +25,8 @@ from . import assert_node_install_operations
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(str(tmpdir),
+                                  model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/builtin/test_uninstall.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_uninstall.py b/tests/orchestrator/workflows/builtin/test_uninstall.py
index 126c4cf..5a34494 100644
--- a/tests/orchestrator/workflows/builtin/test_uninstall.py
+++ b/tests/orchestrator/workflows/builtin/test_uninstall.py
@@ -26,7 +26,8 @@ from . import assert_node_uninstall_operations
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(str(tmpdir),
+                                  model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/core/test_engine.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_engine.py b/tests/orchestrator/workflows/core/test_engine.py
index d9b50a9..68ba477 100644
--- a/tests/orchestrator/workflows/core/test_engine.py
+++ b/tests/orchestrator/workflows/core/test_engine.py
@@ -124,7 +124,9 @@ class BaseTest(object):
 
     @pytest.fixture
     def workflow_context(self, tmpdir):
-        workflow_context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+        workflow_context = mock.context.simple(
+            str(tmpdir),
+            model_driver_kwargs=dict(base_dir=str(tmpdir)))
         workflow_context.states = []
         workflow_context.exception = None
         yield workflow_context

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/core/test_task.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task.py b/tests/orchestrator/workflows/core/test_task.py
index 061a3f2..7ffe045 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -31,7 +31,9 @@ from tests import mock, storage
 
 @pytest.fixture
 def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    context = mock.context.simple(
+        str(tmpdir),
+        model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield context
     storage.release_sqlite_storage(context.model)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
index cd37bde..57be075 100644
--- a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
+++ b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
@@ -22,9 +22,9 @@ from tests import mock
 from tests import storage
 
 
-def test_task_graph_into_execution_graph():
+def test_task_graph_into_execution_graph(tmpdir):
     operation_name = 'tosca.interfaces.node.lifecycle.Standard.create'
-    task_context = mock.context.simple(storage.get_sqlite_api_kwargs())
+    task_context = mock.context.simple(str(tmpdir))
     node_instance = \
         task_context.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
     def sub_workflow(name, **_):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/executor/test_process_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor.py b/tests/orchestrator/workflows/executor/test_process_executor.py
index bf910db..c6a3fa1 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor.py
@@ -74,8 +74,7 @@ class TestProcessExecutor(object):
 
 @pytest.fixture
 def model(tmpdir):
-    api_kwargs = tests.storage.get_sqlite_api_kwargs(str(tmpdir))
-    result = application_model_storage(SQLAlchemyModelAPI, driver_kwargs=api_kwargs)
+    result = application_model_storage(SQLAlchemyModelAPI, api_kwargs=dict(base_dir=str(tmpdir)))
     yield result
     tests.storage.release_sqlite_storage(result)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/executor/test_process_executor_extension.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index 4a8ef57..9e8623e 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -75,6 +75,7 @@ def executor():
 
 @pytest.fixture
 def context(tmpdir):
-    result = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    result = mock.context.simple(str(tmpdir),
+                                 model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield result
     storage.release_sqlite_storage(result.model)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
index bd1fa96..45793c4 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
@@ -148,6 +148,7 @@ def executor():
 
 @pytest.fixture
 def context(tmpdir):
-    result = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+    result = mock.context.simple(str(tmpdir),
+                                 model_driver_kwargs=dict(base_dir=str(tmpdir)))
     yield result
     storage.release_sqlite_storage(result.model)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/storage/__init__.py
----------------------------------------------------------------------
diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py
index 3b3715e..3c1ac68 100644
--- a/tests/storage/__init__.py
+++ b/tests/storage/__init__.py
@@ -52,35 +52,6 @@ class TestFileSystem(object):
         rmtree(self.path, ignore_errors=True)
 
 
-def get_sqlite_api_kwargs(base_dir=None, filename='db.sqlite'):
-    """
-    Create sql params. works in in-memory and in filesystem mode.
-    If base_dir is passed, the mode will be filesystem mode. while the default mode is in-memory.
-    :param str base_dir: The base dir for the filesystem memory file.
-    :param str filename: the file name - defaults to 'db.sqlite'.
-    :return:
-    """
-    if base_dir is not None:
-        uri = 'sqlite:///{platform_char}{path}'.format(
-            # Handles the windows behavior where there is not root, but drivers.
-            # Thus behaving as relative path.
-            platform_char='' if 'Windows' in platform.system() else '/',
-
-            path=os.path.join(base_dir, filename))
-        engine_kwargs = {}
-    else:
-        uri = 'sqlite:///:memory:'
-        engine_kwargs = dict(connect_args={'check_same_thread': False},
-                             poolclass=pool.StaticPool)
-
-    engine = create_engine(uri, **engine_kwargs)
-    session_factory = orm.sessionmaker(bind=engine)
-    session = orm.scoped_session(session_factory=session_factory) if base_dir else session_factory()
-
-    model.DeclarativeBase.metadata.create_all(bind=engine)
-    return dict(engine=engine, session=session)
-
-
 def release_sqlite_storage(storage):
     """
     Drops the tables and clears the session

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/storage/test_instrumentation.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_instrumentation.py b/tests/storage/test_instrumentation.py
index 9b4da4f..db888b3 100644
--- a/tests/storage/test_instrumentation.py
+++ b/tests/storage/test_instrumentation.py
@@ -25,7 +25,7 @@ from aria.storage import (
     instrumentation,
     exceptions
 )
-from ..storage import get_sqlite_api_kwargs, release_sqlite_storage
+from ..storage import release_sqlite_storage
 
 
 STUB = instrumentation._STUB
@@ -330,7 +330,6 @@ def restore_instrumentation():
 def storage():
     result = ModelStorage(
         api_cls=sql_mapi.SQLAlchemyModelAPI,
-        api_kwargs=get_sqlite_api_kwargs(),
         items=(MockModel1, MockModel2, StrictMockModel))
     yield result
     release_sqlite_storage(result)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/storage/test_model_storage.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_model_storage.py b/tests/storage/test_model_storage.py
index 09d59c4..e67de4a 100644
--- a/tests/storage/test_model_storage.py
+++ b/tests/storage/test_model_storage.py
@@ -22,14 +22,14 @@ from aria.storage import (
     sql_mapi,
 )
 from aria import application_model_storage
-from ..storage import get_sqlite_api_kwargs, release_sqlite_storage
+from ..storage import release_sqlite_storage
 
 from . import MockModel
 
 
 @pytest.fixture
 def storage():
-    base_storage = ModelStorage(sql_mapi.SQLAlchemyModelAPI, api_kwargs=get_sqlite_api_kwargs())
+    base_storage = ModelStorage(sql_mapi.SQLAlchemyModelAPI)
     base_storage.register(MockModel)
     yield base_storage
     release_sqlite_storage(base_storage)
@@ -60,8 +60,7 @@ def test_model_storage(storage):
 
 
 def test_application_storage_factory():
-    storage = application_model_storage(sql_mapi.SQLAlchemyModelAPI,
-                                        driver_kwargs=get_sqlite_api_kwargs())
+    storage = application_model_storage(sql_mapi.SQLAlchemyModelAPI)
     assert storage.node
     assert storage.node_instance
     assert storage.plugin

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/storage/test_models.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py
index 56516f1..a3fa623 100644
--- a/tests/storage/test_models.py
+++ b/tests/storage/test_models.py
@@ -39,7 +39,7 @@ from aria.storage.model import (
 
 
 from tests import mock
-from tests.storage import get_sqlite_api_kwargs, release_sqlite_storage
+from tests.storage import release_sqlite_storage
 
 
 @contextmanager
@@ -54,8 +54,7 @@ def sql_storage(storage_func):
 
 
 def _empty_storage():
-    return application_model_storage(sql_mapi.SQLAlchemyModelAPI,
-                                     driver_kwargs=get_sqlite_api_kwargs())
+    return application_model_storage(sql_mapi.SQLAlchemyModelAPI)
 
 
 def _blueprint_storage():

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/storage/test_structures.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_structures.py b/tests/storage/test_structures.py
index 0223a98..4473916 100644
--- a/tests/storage/test_structures.py
+++ b/tests/storage/test_structures.py
@@ -25,7 +25,7 @@ from aria.storage import (
     exceptions
 )
 
-from ..storage import get_sqlite_api_kwargs, release_sqlite_storage, structure
+from ..storage import release_sqlite_storage, structure
 from . import MockModel
 from ..mock import (
     models,
@@ -36,7 +36,7 @@ from ..mock import (
 
 @pytest.fixture
 def storage():
-    base_storage = ModelStorage(sql_mapi.SQLAlchemyModelAPI, api_kwargs=get_sqlite_api_kwargs())
+    base_storage = ModelStorage(sql_mapi.SQLAlchemyModelAPI)
     base_storage.register(MockModel)
     yield base_storage
     release_sqlite_storage(base_storage)
@@ -48,8 +48,8 @@ def module_cleanup():
 
 
 @pytest.fixture
-def context():
-    return mock_context.simple(get_sqlite_api_kwargs())
+def context(tmpdir):
+    return mock_context.simple(str(tmpdir))
 
 
 def test_inner_dict_update(storage):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e94bfc8/tests/utils/test_plugin.py
----------------------------------------------------------------------
diff --git a/tests/utils/test_plugin.py b/tests/utils/test_plugin.py
index e80cb87..2602488 100644
--- a/tests/utils/test_plugin.py
+++ b/tests/utils/test_plugin.py
@@ -49,8 +49,7 @@ class TestPluginManager(object):
 
 @pytest.fixture
 def model():
-    api_kwargs = storage.get_sqlite_api_kwargs()
-    model = application_model_storage(SQLAlchemyModelAPI, driver_kwargs=api_kwargs)
+    model = application_model_storage(SQLAlchemyModelAPI)
     yield model
     storage.release_sqlite_storage(model)