@@ -124,7 +124,7 @@ def can_connect(self, server, client):
124124 except zmq .Again :
125125 warnings .warn ("client set POLLIN, but cannot recv" , RuntimeWarning )
126126 else :
127- self . assertEqual ( rcvd_msg , msg )
127+ assert rcvd_msg == msg
128128 result = True
129129 return result
130130
@@ -139,15 +139,15 @@ def test_null(self):
139139
140140 server = self .socket (zmq .PUSH )
141141 client = self .socket (zmq .PULL )
142- self .assertTrue ( self . can_connect (server , client ) )
142+ assert self .can_connect (server , client )
143143
144144 # By setting a domain we switch on authentication for NULL sockets,
145145 # though no policies are configured yet. The client connection
146146 # should still be allowed.
147147 server = self .socket (zmq .PUSH )
148148 server .zap_domain = b'global'
149149 client = self .socket (zmq .PULL )
150- self .assertTrue ( self . can_connect (server , client ) )
150+ assert self .can_connect (server , client )
151151
152152 def test_blacklist (self ):
153153 """threaded auth - Blacklist"""
@@ -158,7 +158,7 @@ def test_blacklist(self):
158158 # though no policies are configured yet.
159159 server .zap_domain = b'global'
160160 client = self .socket (zmq .PULL )
161- self .assertFalse ( self . can_connect (server , client ) )
161+ assert not self .can_connect (server , client )
162162
163163 def test_whitelist (self ):
164164 """threaded auth - Whitelist"""
@@ -169,7 +169,7 @@ def test_whitelist(self):
169169 # though no policies are configured yet.
170170 server .zap_domain = b'global'
171171 client = self .socket (zmq .PULL )
172- self .assertTrue ( self . can_connect (server , client ) )
172+ assert self .can_connect (server , client )
173173
174174 def test_plain (self ):
175175 """threaded auth - PLAIN"""
@@ -180,7 +180,7 @@ def test_plain(self):
180180 client = self .socket (zmq .PULL )
181181 client .plain_username = b'admin'
182182 client .plain_password = b'Password'
183- self .assertFalse ( self . can_connect (server , client ) )
183+ assert not self .can_connect (server , client )
184184
185185 # Try PLAIN authentication - with server configured, connection should pass
186186 server = self .socket (zmq .PUSH )
@@ -189,23 +189,23 @@ def test_plain(self):
189189 client .plain_username = b'admin'
190190 client .plain_password = b'Password'
191191 self .auth .configure_plain (domain = '*' , passwords = {'admin' : 'Password' })
192- self .assertTrue ( self . can_connect (server , client ) )
192+ assert self .can_connect (server , client )
193193
194194 # Try PLAIN authentication - with bogus credentials, connection should fail
195195 server = self .socket (zmq .PUSH )
196196 server .plain_server = True
197197 client = self .socket (zmq .PULL )
198198 client .plain_username = b'admin'
199199 client .plain_password = b'Bogus'
200- self .assertFalse ( self . can_connect (server , client ) )
200+ assert not self .can_connect (server , client )
201201
202202 # Remove authenticator and check that a normal connection works
203203 self .auth .stop ()
204204 self .auth = None
205205
206206 server = self .socket (zmq .PUSH )
207207 client = self .socket (zmq .PULL )
208- self .assertTrue ( self . can_connect (server , client ) )
208+ assert self .can_connect (server , client )
209209 client .close ()
210210 server .close ()
211211
@@ -224,7 +224,7 @@ def test_curve(self):
224224 client .curve_publickey = client_public
225225 client .curve_secretkey = client_secret
226226 client .curve_serverkey = server_public
227- self .assertFalse ( self . can_connect (server , client ) )
227+ assert not self .can_connect (server , client )
228228
229229 # Try CURVE authentication - with server configured to CURVE_ALLOW_ANY, connection should pass
230230 self .auth .configure_curve (domain = '*' , location = zmq .auth .CURVE_ALLOW_ANY )
@@ -236,7 +236,7 @@ def test_curve(self):
236236 client .curve_publickey = client_public
237237 client .curve_secretkey = client_secret
238238 client .curve_serverkey = server_public
239- self .assertTrue ( self . can_connect (server , client ) )
239+ assert self .can_connect (server , client )
240240
241241 # Try CURVE authentication - with server configured, connection should pass
242242 self .auth .configure_curve (domain = '*' , location = self .public_keys_dir )
@@ -257,7 +257,7 @@ def test_curve(self):
257257 # Try connecting using NULL and no authentication enabled, connection should pass
258258 server = self .socket (zmq .PUSH )
259259 client = self .socket (zmq .PULL )
260- self .assertTrue ( self . can_connect (server , client ) )
260+ assert self .can_connect (server , client )
261261
262262 def test_curve_callback (self ):
263263 """threaded auth - CURVE with callback authentication"""
@@ -274,7 +274,7 @@ def test_curve_callback(self):
274274 client .curve_publickey = client_public
275275 client .curve_secretkey = client_secret
276276 client .curve_serverkey = server_public
277- self .assertFalse ( self . can_connect (server , client ) )
277+ assert not self .can_connect (server , client )
278278
279279 # Try CURVE authentication - with callback authentication configured, connection should pass
280280
@@ -298,7 +298,7 @@ def callback(self, domain, key):
298298 client .curve_publickey = client_public
299299 client .curve_secretkey = client_secret
300300 client .curve_serverkey = server_public
301- self .assertTrue ( self . can_connect (server , client ) )
301+ assert self .can_connect (server , client )
302302
303303 # Try CURVE authentication - with callback authentication configured with wrong key, connection should not pass
304304
@@ -322,7 +322,7 @@ def callback(self, domain, key):
322322 client .curve_publickey = client_public
323323 client .curve_secretkey = client_secret
324324 client .curve_serverkey = server_public
325- self .assertFalse ( self . can_connect (server , client ) )
325+ assert not self .can_connect (server , client )
326326
327327 @skip_pypy
328328 def test_curve_user_id (self ):
0 commit comments