def test_is_expired(self, mock_socket): conn = TcpConnection('localhost', 2000, lifetime=1) conn.open() ok_(not conn.is_expired()) time.sleep(1) ok_(conn.is_expired())