def _get_conn(self, key): key = dumps(key, 0) t_id = get_ident() if t_id not in self.connection_cache: self.connection_cache[t_id] = {} if key not in self.connection_cache[t_id]: conn = sqlite3.Connection(self.path, timeout=60, check_same_thread=False) with conn: conn.execute(self._create_sql) self.connection_cache[t_id][key] = conn return self.connection_cache[t_id][key]
def queue_mark(queue, delay): time.sleep(delay) queue.put(_thread.get_ident())
def test_ident(self): self.assertIsInstance(_thread.get_ident(), int, "_thread.get_ident() returned a non-integer") self.assertNotEqual(_thread.get_ident(), 0, "_thread.get_ident() returned 0")
def test_ident(self): #Test sanity of _thread.get_ident() self.assertIsInstance(_thread.get_ident(), int, "_thread.get_ident() returned a non-integer") self.assertTrue(_thread.get_ident() != 0, "_thread.get_ident() returned 0")
def queue_mark(queue, delay): """Wait for ``delay`` seconds and then put something into ``queue``""" time.sleep(delay) queue.put(_thread.get_ident())
def test_ident(self): self.assertIsInstance(_thread.get_ident(), int, "_thread.get_ident() returned a non-integer") self.assertGreater(_thread.get_ident(), 0)
def test_ident(self): #Test sanity of _thread.get_ident() self.failUnless(isinstance(_thread.get_ident(), int), "_thread.get_ident() returned a non-integer") self.failUnless(_thread.get_ident() != 0, "_thread.get_ident() returned 0")
def update_event(self, inp=-1): self.set_output_val(0, _dummy_thread.get_ident())