File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,11 @@ def environment_auth(pytestconfig):
4646 uri = "amqp://localhost:5672" ,
4747 oauth2_options = OAuth2Options (token = token_string ),
4848 )
49- # try:
50- return environment
49+ try :
50+ yield environment
5151
52- # finally:
53- # environment.close()
52+ finally :
53+ environment .close ()
5454
5555
5656@pytest .fixture ()
Original file line number Diff line number Diff line change 44from rabbitmq_amqp_python_client import (
55 ConnectionClosed ,
66 Environment ,
7+ QuorumQueueSpecification ,
78 RecoveryConfiguration ,
89 StreamSpecification ,
910 ValidationCodeException ,
@@ -50,6 +51,22 @@ def test_connection_auth(environment_auth: Environment) -> None:
5051 connection .close ()
5152
5253
54+ def test_connection_auth_with_timeout (environment_auth : Environment ) -> None :
55+
56+ connection = environment_auth .connection ()
57+ connection .dial ()
58+ time .sleep (3 )
59+ raised = False
60+ try :
61+ management = connection .management ()
62+ management .declare_queue (QuorumQueueSpecification (name = "test-queue" ))
63+ except Exception :
64+ raised = True
65+
66+ assert raised is True
67+ connection .close ()
68+
69+
5370def test_environment_connections_management () -> None :
5471
5572 environment = Environment (uri = "amqp://guest:guest@localhost:5672/" )
You can’t perform that action at this time.
0 commit comments