mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] conftest: reduce log spam in test results
Avoid logging below warning during the creation of the template db, and don't emit `odoo.modules.loading` during tests. That reduces log-spam a lot and makes tests results way more readable (in case of failure, where the logs of the subprocess get printed out).
This commit is contained in:
parent
bf34e9aa95
commit
1e296a4713
17
conftest.py
17
conftest.py
@ -263,15 +263,15 @@ class DbDict(dict):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self._adpath = adpath
|
self._adpath = adpath
|
||||||
def __missing__(self, module):
|
def __missing__(self, module):
|
||||||
db = 'template_%s' % uuid.uuid4()
|
self[module] = db = 'template_%s' % uuid.uuid4()
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
'odoo', '--no-http',
|
'odoo', '--no-http',
|
||||||
'--addons-path', self._adpath,
|
'--addons-path', self._adpath,
|
||||||
'-d', db, '-i', module,
|
'-d', db, '-i', module,
|
||||||
'--max-cron-threads', '0',
|
'--max-cron-threads', '0',
|
||||||
'--stop-after-init'
|
'--stop-after-init',
|
||||||
|
'--log-level', 'warn'
|
||||||
], check=True)
|
], check=True)
|
||||||
self[module] = db
|
|
||||||
return db
|
return db
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
@ -332,15 +332,18 @@ def port():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def server(request, db, port, module):
|
def server(request, db, port, module):
|
||||||
opts = ['--log-handler', 'github_requests:WARNING']
|
log_handlers = [
|
||||||
if request.config.getoption('--log-github'):
|
'odoo.modules.loading:WARNING',
|
||||||
opts = []
|
]
|
||||||
|
if not request.config.getoption('--log-github'):
|
||||||
|
log_handlers.append('github_requests:WARNING')
|
||||||
|
|
||||||
p = subprocess.Popen([
|
p = subprocess.Popen([
|
||||||
'odoo', '--http-port', str(port),
|
'odoo', '--http-port', str(port),
|
||||||
'--addons-path', request.config.getoption('--addons-path'),
|
'--addons-path', request.config.getoption('--addons-path'),
|
||||||
'-d', db, *opts,
|
'-d', db,
|
||||||
'--max-cron-threads', '0', # disable cron threads (we're running crons by hand)
|
'--max-cron-threads', '0', # disable cron threads (we're running crons by hand)
|
||||||
|
*itertools.chain.from_iterable(('--log-handler', h) for h in log_handlers),
|
||||||
])
|
])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user