BVB Source Codes

rq Show test_connection.py Source code

Return Download rq: download test_connection.py Source code - Download rq Source code - Type:.py
  1. # -*- coding: utf-8 -*-
  2. from __future__ import (absolute_import, division, print_function,
  3.                         unicode_literals)
  4.  
  5. from rq import Connection, Queue
  6.  
  7. from tests import find_empty_redis_database, RQTestCase
  8. from tests.fixtures import do_nothing
  9.  
  10.  
  11. def new_connection():
  12.     return find_empty_redis_database()
  13.  
  14.  
  15. class TestConnectionInheritance(RQTestCase):
  16.     def test_connection_detection(self):
  17.         """Automatic detection of the connection."""
  18.         q = Queue()
  19.         self.assertEqual(q.connection, self.testconn)
  20.  
  21.     def test_connection_stacking(self):
  22.         """Connection stacking."""
  23.         conn1 = new_connection()
  24.         conn2 = new_connection()
  25.  
  26.         with Connection(conn1):
  27.             q1 = Queue()
  28.             with Connection(conn2):
  29.                 q2 = Queue()
  30.         self.assertNotEqual(q1.connection, q2.connection)
  31.  
  32.     def test_connection_pass_thru(self):
  33.         """Connection passed through from queues to jobs."""
  34.         q1 = Queue()
  35.         with Connection(new_connection()):
  36.             q2 = Queue()
  37.         job1 = q1.enqueue(do_nothing)
  38.         job2 = q2.enqueue(do_nothing)
  39.         self.assertEqual(q1.connection, job1.connection)
  40.         self.assertEqual(q2.connection, job2.connection)
  41.  
downloadtest_connection.py Source code - Download rq Source code
Related Source Codes/Software:
amazon-dsstne - Deep Scalable Sparse Tensor Network Engine (DSSTNE... 2017-01-08
webpack-demos - a collection of simple demos of Webpack 2017-01-08
Squire - HTML5 rich text editor. Try the demo integration a... 2017-01-08
thor - Thor is a toolkit for building powerful command-li... 2017-01-08
glide - Package Management for Golang h... 2017-01-08
emmet-vim - emmet for vim: http://emmet.io/ ... 2017-01-08
prose - A Content Editor for GitHub. ht... 2017-01-08
sshrc - ring your .bashrc, .vimrc, etc. with you when you ... 2017-01-08
typed.js - A jQuery typing animation script. ... 2017-01-08
find - High-precision indoor positioning framework for mo... 2017-01-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top