|
18 | 18 | # [This file includes modifications made by New Vector Limited]
|
19 | 19 | #
|
20 | 20 | #
|
| 21 | +import importlib.resources as importlib_resources |
21 | 22 | import os
|
22 | 23 | import re
|
23 | 24 | from email.parser import Parser
|
24 | 25 | from http import HTTPStatus
|
25 | 26 | from typing import Any, Dict, List, Optional, Union
|
26 | 27 | from unittest.mock import Mock
|
27 | 28 |
|
28 |
| -import pkg_resources |
29 |
| - |
30 | 29 | from twisted.internet.interfaces import IReactorTCP
|
31 | 30 | from twisted.internet.testing import MemoryReactor
|
32 | 31 |
|
@@ -59,11 +58,12 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
59 | 58 | config = self.default_config()
|
60 | 59 |
|
61 | 60 | # Email config.
|
| 61 | + templates = ( |
| 62 | + importlib_resources.files("synapse").joinpath("res").joinpath("templates") |
| 63 | + ) |
62 | 64 | config["email"] = {
|
63 | 65 | "enable_notifs": False,
|
64 |
| - "template_dir": os.path.abspath( |
65 |
| - pkg_resources.resource_filename("synapse", "res/templates") |
66 |
| - ), |
| 66 | + "template_dir": os.path.abspath(str(templates)), |
67 | 67 | "smtp_host": "127.0.0.1",
|
68 | 68 | "smtp_port": 20,
|
69 | 69 | "require_transport_security": False,
|
@@ -798,11 +798,12 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
798 | 798 | config = self.default_config()
|
799 | 799 |
|
800 | 800 | # Email config.
|
| 801 | + templates = ( |
| 802 | + importlib_resources.files("synapse").joinpath("res").joinpath("templates") |
| 803 | + ) |
801 | 804 | config["email"] = {
|
802 | 805 | "enable_notifs": False,
|
803 |
| - "template_dir": os.path.abspath( |
804 |
| - pkg_resources.resource_filename("synapse", "res/templates") |
805 |
| - ), |
| 806 | + "template_dir": os.path.abspath(str(templates)), |
806 | 807 | "smtp_host": "127.0.0.1",
|
807 | 808 | "smtp_port": 20,
|
808 | 809 | "require_transport_security": False,
|
|
0 commit comments