@@ -500,6 +500,7 @@ def test_mongodb_x509_auth(self):
500
500
ssl = True ,
501
501
tlsAllowInvalidCertificates = True ,
502
502
tlsCertificateKeyFile = CLIENT_PEM )
503
+ self .addCleanup (noauth .close )
503
504
504
505
with self .assertRaises (OperationFailure ):
505
506
noauth .pymongo_test .test .find_one ()
@@ -512,6 +513,7 @@ def test_mongodb_x509_auth(self):
512
513
tlsAllowInvalidCertificates = True ,
513
514
tlsCertificateKeyFile = CLIENT_PEM ,
514
515
event_listeners = [listener ])
516
+ self .addCleanup (auth .close )
515
517
516
518
# No error
517
519
auth .pymongo_test .test .find_one ()
@@ -529,6 +531,7 @@ def test_mongodb_x509_auth(self):
529
531
ssl = True ,
530
532
tlsAllowInvalidCertificates = True ,
531
533
tlsCertificateKeyFile = CLIENT_PEM )
534
+ self .addCleanup (client .close )
532
535
# No error
533
536
client .pymongo_test .test .find_one ()
534
537
@@ -537,6 +540,7 @@ def test_mongodb_x509_auth(self):
537
540
ssl = True ,
538
541
tlsAllowInvalidCertificates = True ,
539
542
tlsCertificateKeyFile = CLIENT_PEM )
543
+ self .addCleanup (client .close )
540
544
# No error
541
545
client .pymongo_test .test .find_one ()
542
546
# Auth should fail if username and certificate do not match
@@ -545,7 +549,9 @@ def test_mongodb_x509_auth(self):
545
549
quote_plus ("not the username" ), host , port ))
546
550
547
551
bad_client = MongoClient (
548
- uri , ssl = True , tlsAllowInvalidCertificates = True , tlsCertificateKeyFile = CLIENT_PEM )
552
+ uri , ssl = True , tlsAllowInvalidCertificates = True ,
553
+ tlsCertificateKeyFile = CLIENT_PEM )
554
+ self .addCleanup (bad_client .close )
549
555
550
556
with self .assertRaises (OperationFailure ):
551
557
bad_client .pymongo_test .test .find_one ()
@@ -557,6 +563,7 @@ def test_mongodb_x509_auth(self):
557
563
ssl = True ,
558
564
tlsAllowInvalidCertificates = True ,
559
565
tlsCertificateKeyFile = CLIENT_PEM )
566
+ self .addCleanup (bad_client .close )
560
567
561
568
with self .assertRaises (OperationFailure ):
562
569
bad_client .pymongo_test .test .find_one ()
0 commit comments