Skip to content

Commit 06a1b29

Browse files
StefanRijnhartdreispt
authored andcommitted
[IMP] Mute logging related to checkpoint notifications in tests
``` 2020-11-05 13:36:35,202 6822 INFO openerp_test odoo.tests: skip sending email in test mode 2020-11-05 13:36:35,206 6822 INFO openerp_test odoo.addons.mail.models.mail_mail: Mail with ID 1 and Message-Id '<342741149332557.1604583395.110157728195190-openerp-1-connector.checkpoint@travis-job-14c1db44-ca6c-40e2-82ff-03dcf3df66dc>' successfully sent 2020-11-05 13:36:35,227 6822 INFO openerp_test odoo.models.unlink: User OCA#1 deleted mail.mail records with IDs: [1] 2020-11-05 13:36:35,228 6822 INFO openerp_test odoo.addons.mail.models.mail_mail: Sent batch 1 emails via mail server ID #False ```
1 parent 3ac28f1 commit 06a1b29

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

connector_magento/tests/common.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from contextlib import contextmanager
2121
from odoo import models
2222
from odoo.addons.component.tests.common import SavepointComponentCase
23+
from odoo.tools import mute_logger
2324

2425
from vcr import VCR
2526

@@ -160,11 +161,16 @@ def _import_record(self, model_name, magento_id, cassette=True):
160161
filename = 'import_%s_%s' % (table_name[8:], str(magento_id))
161162

162163
def run_import():
163-
if self.backend.version != '1.7':
164-
return self.env[model_name].import_record(
165-
self.backend, magento_id)
166-
with mock_urlopen_image():
167-
self.env[model_name].import_record(self.backend, magento_id)
164+
with mute_logger(
165+
'odoo.addons.mail.models.mail_mail',
166+
'odoo.models.unlink',
167+
'odoo.tests'):
168+
if self.backend.version != '1.7':
169+
return self.env[model_name].import_record(
170+
self.backend, magento_id)
171+
with mock_urlopen_image():
172+
self.env[model_name].import_record(
173+
self.backend, magento_id)
168174

169175
if cassette:
170176
with self.recorder.use_cassette(filename):
@@ -271,5 +277,10 @@ class MagentoSyncTestCase(MagentoTestCase):
271277

272278
def setUp(self):
273279
super(MagentoSyncTestCase, self).setUp()
274-
with recorder.use_cassette('metadata'):
275-
self.backend.synchronize_metadata()
280+
# Mute logging of notifications about new checkpoints
281+
with mute_logger(
282+
'odoo.addons.mail.models.mail_mail',
283+
'odoo.models.unlink',
284+
'odoo.tests'):
285+
with recorder.use_cassette('metadata'):
286+
self.backend.synchronize_metadata()

connector_magento/tests/magento2/common.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from os.path import dirname, join
1414
from vcr import VCR
1515

16+
from odoo.tools import mute_logger
1617
from ..common import MagentoTestCase
1718

1819

@@ -38,5 +39,9 @@ def setUp(self):
3839
class Magento2SyncTestCase(Magento2TestCase):
3940
def setUp(self):
4041
super(Magento2SyncTestCase, self).setUp()
41-
with recorder.use_cassette('metadata'):
42-
self.backend.synchronize_metadata()
42+
with mute_logger(
43+
'odoo.addons.mail.models.mail_mail',
44+
'odoo.models.unlink',
45+
'odoo.tests'):
46+
with recorder.use_cassette('metadata'):
47+
self.backend.synchronize_metadata()

0 commit comments

Comments
 (0)