def test_cozydb_cozystore_get_cursor(self): store = CozyStore(**self.db_args) cursor1 = store.get_cursor() cursor2 = store.get_cursor() ok_(cursor1 is cursor2) cursor1.execute('select 1') eq_(cursor1.fetchone(), (1,)) cursor3 = store.get_cursor(use_cache=False) ok_(cursor1 is not cursor3) cursor3.execute('select 1') eq_(cursor3.fetchone(), (1,))
def test_cozydb_cozystore_get_cursor(self): store = CozyStore(**self.db_args) cursor1 = store.get_cursor() cursor2 = store.get_cursor() ok_(cursor1 is cursor2) cursor1.execute('select 1') eq_(cursor1.fetchone(), (1, )) cursor3 = store.get_cursor(use_cache=False) ok_(cursor1 is not cursor3) cursor3.execute('select 1') eq_(cursor3.fetchone(), (1, ))
def _get_tmp_cursor(self): _args = self.db_args.copy() _args.pop('db', None) store = CozyStore(**_args) return store.get_cursor()