File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 11import pytest
2-
3-
4- def pytest_report_header (config ) -> str :
5- """Pytest headers."""
6- return "package: modmail"
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+
4+ def pytest_report_header (config ) -> str :
5+ """Pytest headers."""
6+ return "package: modmail"
7+
8+
9+ @pytest .fixture (autouse = True , scope = "package" )
10+ def patch_embeds ():
11+ """Run the patch embed method. This is normally run by modmail.__main__, which is not run for testing."""
12+ import modmail .utils .embeds
13+
14+ modmail .utils .embeds .patch_embed ()
Original file line number Diff line number Diff line change 1+ import unittest .mock
2+
13import discord
24import pytest
35
@@ -10,9 +12,10 @@ def test_patch_embed() -> None:
1012 from modmail .utils .embeds import __init__ as init
1113 from modmail .utils .embeds import original_init
1214
13- assert discord .Embed .__init__ == original_init
14- patch_embed ()
15- assert discord .Embed .__init__ == init
15+ with unittest .mock .patch .object (discord .Embed , "__init__" , original_init ):
16+ assert discord .Embed .__init__ == original_init
17+ patch_embed ()
18+ assert discord .Embed .__init__ == init
1619
1720
1821@pytest .mark .dependency (depends_on = "patch_embed" )
You can’t perform that action at this time.
0 commit comments