-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bebddf2
commit 50fa884
Showing
5 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "addon that generates warnings", | ||
"version": "1.0.0", | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_warning |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import logging | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
class Test(TransactionCase): | ||
def test_log_warning(self): | ||
_logger.warning("This is a warning") |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import subprocess | ||
from .common import install_test_addons, dropdb, did_run_test_module | ||
|
||
|
||
def test_checklog_enabled(): | ||
"""Test addon_warning with checklog enabled.""" | ||
with install_test_addons(["addon_warning"]) as addons_dir: | ||
dropdb() | ||
subprocess.check_call(["oca_init_test_database"], cwd=addons_dir) | ||
os.environ["OCA_ENABLE_CHECKLOG_ODOO"] = "1" | ||
result = subprocess.run( | ||
["oca_run_tests"], cwd=addons_dir, text=True, capture_output=True | ||
) | ||
os.environ["OCA_ENABLE_CHECKLOG_ODOO"] = "" | ||
assert result.returncode == 1 and "Error: Errors detected in log." in result.stderr | ||
|
||
def test_checklog_disabled(): | ||
"""Test addon_warning with checklog disabled.""" | ||
with install_test_addons(["addon_warning"]) as addons_dir: | ||
dropdb() | ||
subprocess.check_call(["oca_init_test_database"], cwd=addons_dir) | ||
result = subprocess.check_output( | ||
["oca_run_tests"], cwd=addons_dir, text=True | ||
) | ||
assert did_run_test_module(result, "addon_warning.tests.test_warning") |