summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlowercase00 <21188280+lowercase00@users.noreply.github.com>2023-03-07 00:54:47 -0300
committerGitHub <noreply@github.com>2023-03-07 10:54:47 +0700
commitd5bde117c2f5477b5d0ba9846f2a7c4480ca1854 (patch)
tree7e43df189b474787860ade15c0f865055b8a0a85 /tests
parent7f9f0f72ba1adac907791d604d5f56af8125fdfd (diff)
downloadrq-d5bde117c2f5477b5d0ba9846f2a7c4480ca1854.tar.gz
Remove `use_connection` (#1859)
* feat: remove use_connection * fix: clear old test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_connection.py33
1 files changed, 2 insertions, 31 deletions
diff --git a/tests/test_connection.py b/tests/test_connection.py
index fdfafbd..393c20d 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -1,9 +1,7 @@
from redis import Redis
-from rq import Connection, Queue, use_connection, get_current_connection, pop_connection
-from rq.connections import NoRedisConnectionException
-
-from tests import find_empty_redis_database, RQTestCase
+from rq import Connection, Queue
+from tests import RQTestCase, find_empty_redis_database
from tests.fixtures import do_nothing
@@ -37,30 +35,3 @@ class TestConnectionInheritance(RQTestCase):
job2 = q2.enqueue(do_nothing)
self.assertEqual(q1.connection, job1.connection)
self.assertEqual(q2.connection, job2.connection)
-
-
-class TestConnectionHelpers(RQTestCase):
- def test_use_connection(self):
- """Test function use_connection works as expected."""
- conn = new_connection()
- use_connection(conn)
-
- self.assertEqual(conn, get_current_connection())
-
- use_connection()
-
- self.assertNotEqual(conn, get_current_connection())
-
- use_connection(self.testconn) # Restore RQTestCase connection
-
- with self.assertRaises(AssertionError):
- with Connection(new_connection()):
- use_connection()
- with Connection(new_connection()):
- use_connection()
-
- def test_resolve_connection_raises_on_no_connection(self):
- """Test function resolve_connection raises if there is no connection."""
- pop_connection()
- with self.assertRaises(NoRedisConnectionException):
- Queue()