@@ -261,10 +261,11 @@ def test_https_connection(self):
261
261
# generation method used for the next two, in case it comes to matter)
262
262
# 3: run with an HTTPS certificate with an unexpected hostname
263
263
# 4: run with an HTTPS certificate that is expired
264
- port1 = str (random .randint (30000 , 45000 ))
265
- port2 = str (int (port1 ) + 1 )
266
- port3 = str (int (port1 ) + 2 )
267
- port4 = str (int (port1 ) + 3 )
264
+ # Be sure to offset from the port used in setUp to avoid collision.
265
+ port1 = str (self .PORT + 1 )
266
+ port2 = str (self .PORT + 2 )
267
+ port3 = str (self .PORT + 3 )
268
+ port4 = str (self .PORT + 4 )
268
269
good_https_server_proc = popen_python (
269
270
['simple_https_server.py' , port1 , good_cert_fname ])
270
271
good2_https_server_proc = popen_python (
@@ -274,13 +275,12 @@ def test_https_connection(self):
274
275
expd_https_server_proc = popen_python (
275
276
['simple_https_server.py' , port4 , expired_cert_fname ])
276
277
277
- # Provide a delay long enough to allow the HTTPS servers to start.
278
- # Encountered an error on one test system at delay value of 0.2s, so
279
- # increasing to 0.5s. Further increasing to 2s due to occasional failures
280
- # in other tests in similar circumstances on AppVeyor.
278
+ # Provide a delay long enough to allow the four HTTPS servers to start.
279
+ # Have encountered errors at 0.2s, 0.5s, and 2s, primarily on AppVeyor.
280
+ # Increasing to 4s for this test.
281
281
# Expect to see "Connection refused" if this delay is not long enough
282
282
# (though other issues could cause that).
283
- time .sleep (2 )
283
+ time .sleep (3 )
284
284
285
285
relative_target_fpath = os .path .basename (target_filepath )
286
286
good_https_url = 'https://localhost:' + port1 + '/' + relative_target_fpath
0 commit comments