-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] base: allow patching of config.options for 3.11
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. Part-of: odoo#112317
- Loading branch information
1 parent
ef85459
commit 9d08b98
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
email_split, email_domain_normalize, | ||
misc, formataddr, | ||
prepend_html_content, | ||
config, | ||
) | ||
|
||
from . import test_mail_examples | ||
|
@@ -465,7 +466,7 @@ def test_email_domain_normalize(self): | |
|
||
|
||
class EmailConfigCase(TransactionCase): | ||
@patch.dict("odoo.tools.config.options", {"email_from": "[email protected]"}) | ||
@patch.dict(config.options, {"email_from": "[email protected]"}) | ||
def test_default_email_from(self, *args): | ||
"""Email from setting is respected.""" | ||
# ICP setting is more important | ||
|