Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core


Commits:
985a255e by Abhilash Raj at 2022-02-27T11:04:24-08:00
Use importlib_resources instead of pkg_resources

- - - - -
24a61268 by Abhilash Raj at 2022-02-28T02:42:00+00:00
Merge branch 'pkg-resource' into 'master'

Use importlib_resources instead of pkg_resources

See merge request mailman/mailman!969
- - - - -


1 changed file:

- src/mailman/testing/layers.py


Changes:

=====================================
src/mailman/testing/layers.py
=====================================
@@ -32,7 +32,7 @@ import logging
 import datetime
 import tempfile
 
-from importlib_resources import read_text
+from importlib_resources import files, read_text
 from lazr.config import as_boolean
 from mailman.config import config
 from mailman.core import initialize
@@ -46,7 +46,6 @@ from mailman.testing.mta import (
     ConnectionCountingController, ConnectionCountingSSLController,
     ConnectionCountingSTARTTLSController)
 from mailman.utilities.string import expand
-from pkg_resources import resource_filename
 from public import public
 from textwrap import dedent
 from zope.component import getUtility
@@ -276,10 +275,8 @@ class SMTPSLayer(ConfigLayer):
         smtp_port: 9465
         smtp_secure_mode: smtps
         """)
-        test_cert_path = resource_filename('mailman.testing',
-                                           'ssl_test_cert.crt')
-        test_key_path = resource_filename('mailman.testing',
-                                          'ssl_test_key.key')
+        test_cert_path = files('mailman.testing') / 'ssl_test_cert.crt'
+        test_key_path = files('mailman.testing') / 'ssl_test_key.key'
 
         client_context = ssl.create_default_context()
         client_context.load_verify_locations(cafile=test_cert_path)
@@ -331,10 +328,8 @@ class STARTTLSLayer(ConfigLayer):
         smtp_port: 9587
         smtp_secure_mode: starttls
         """)
-        test_cert_path = resource_filename('mailman.testing',
-                                           'ssl_test_cert.crt')
-        test_key_path = resource_filename('mailman.testing',
-                                          'ssl_test_key.key')
+        test_cert_path = files('mailman.testing') / 'ssl_test_cert.crt'
+        test_key_path = files('mailman.testing') / 'ssl_test_key.key'
 
         client_context = ssl.create_default_context()
         client_context.load_verify_locations(cafile=test_cert_path)



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/327424acbaf98c691f3400c67c8aeede49d638f0...24a612680b6f4d4f4cc7e08f737f842811e05b0b

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/327424acbaf98c691f3400c67c8aeede49d638f0...24a612680b6f4d4f4cc7e08f737f842811e05b0b
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to