old_contents: from solar.dblayer.model import Model, ModelMeta
  import pytest
  import time
  import string
  import random
  
  def patched_get_bucket_name(cls):
      return cls.__name__ + str(time.time())
  
  class RndObj(object):
  
      def __init__(self, name):
          self.rnd = name + ''.join((random.choice(string.ascii_lowercase) for x in xrange(8)))
          self.calls = 0
  
      def next(self):
          num = self.calls
          self.calls += 1
          return (self.rnd + str(num))
  
      def __iter__(self):
          return self
  
  @pytest.fixture(scope='function')
  def rk(request):
  
      name = request.module.__name__ + request.function.__name__
  
      obj = RndObj(name)
  
      return obj
  
  @pytest.fixture(scope='function')
  def rt(request):
  
      name = request.module.__name__ + request.function.__name__
  
      obj = RndObj(name)
  
      return obj
  
  
  
  def pytest_runtest_teardown(item, nextitem):
      ModelMeta.session_end(result=True)
      return nextitem
  
  def pytest_runtest_call(item):
      ModelMeta.session_start()
  
  
  Model.get_bucket_name = classmethod(patched_get_bucket_name)
  
  from solar.dblayer.sql_client import SqlClient
  client = SqlClient(':memory:', threadlocals=False, autocommit=False)
  # client = SqlClient('/tmp/blah.db', threadlocals=True,
  #                    autocommit=False, pragmas=(('journal_mode', 'WAL'),
  #                                               ('synchronous', 'NORMAL')))
  
  #from solar.dblayer.riak_client import RiakClient
  #client = RiakClient(protocol='pbc', host='10.0.0.3', pb_port=18087)
  # client = RiakClient(protocol='http', host='10.0.0.3', http_port=18098)
  
  @pytest.fixture
  def riakc():
      return client
  
  ModelMeta.setup(client)
  
new_contents: from solar.dblayer.model import Model, ModelMeta, get_bucket
  import pytest
  import time
  import string
  import random
  
  def patched_get_bucket_name(cls):
      return cls.__name__ + str(time.time())
  
  class RndObj(object):
  
      def __init__(self, name):
          self.rnd = name + ''.join((random.choice(string.ascii_lowercase) for x in xrange(8)))
          self.calls = 0
  
      def next(self):
          num = self.calls
          self.calls += 1
          return (self.rnd + str(num))
  
      def __iter__(self):
          return self
  
  @pytest.fixture(scope='function')
  def rk(request):
  
      name = request.module.__name__ + request.function.__name__
  
      obj = RndObj(name)
  
      return obj
  
  @pytest.fixture(scope='function')
  def rt(request):
  
      name = request.module.__name__ + request.function.__name__
  
      obj = RndObj(name)
  
      return obj
  
  
  @pytest.fixture(autouse=True)
  def setup(request):
  
      for model in ModelMeta._defined_models:
          model.bucket = get_bucket(None, model, ModelMeta)
  
  
  def pytest_runtest_teardown(item, nextitem):
      ModelMeta.session_end(result=True)
      return nextitem
  
  def pytest_runtest_call(item):
      ModelMeta.session_start()
  
  
  Model.get_bucket_name = classmethod(patched_get_bucket_name)
  
  from solar.dblayer.sql_client import SqlClient
  client = SqlClient(':memory:', threadlocals=False, autocommit=False)
  # client = SqlClient('/tmp/blah.db', threadlocals=True,
  #                    autocommit=False, pragmas=(('journal_mode', 'WAL'),
  #                                               ('synchronous', 'NORMAL')))
  
  # from solar.dblayer.riak_client import RiakClient
  # client = RiakClient(protocol='pbc', host='10.0.0.3', pb_port=18087)
  # client = RiakClient(protocol='http', host='10.0.0.3', http_port=18098)
  
  
  ModelMeta.setup(client)
  
subject: Change bucket for every test