[IMP] runbot_merge: allow running test suite without an explicit addons path

This commit is contained in:
Xavier Morel 2023-06-22 14:37:49 +02:00
parent fc41e09f44
commit 72281b0c63

View File

@ -277,7 +277,7 @@ class DbDict(dict):
with tempfile.TemporaryDirectory() as d: with tempfile.TemporaryDirectory() as d:
subprocess.run([ subprocess.run([
'odoo', '--no-http', 'odoo', '--no-http',
'--addons-path', self._adpath, *(['--addons-path', self._adpath] if self._adpath else []),
'-d', db, '-i', module + ',auth_oauth', '-d', db, '-i', module + ',auth_oauth',
'--max-cron-threads', '0', '--max-cron-threads', '0',
'--stop-after-init', '--stop-after-init',
@ -296,7 +296,7 @@ def dbcache(request):
dbs = DbDict(request.config.getoption('--addons-path')) dbs = DbDict(request.config.getoption('--addons-path'))
yield dbs yield dbs
for db in dbs.values(): for db in dbs.values():
subprocess.run(['dropdb', db], check=True) subprocess.run(['dropdb', '--if-exists', db], check=True)
@pytest.fixture @pytest.fixture
def db(request, module, dbcache): def db(request, module, dbcache):
@ -369,10 +369,10 @@ def server(request, db, port, module, dummy_addons_path, tmpdir):
if not request.config.getoption('--log-github'): if not request.config.getoption('--log-github'):
log_handlers.append('github_requests:WARNING') log_handlers.append('github_requests:WARNING')
addons_path = ','.join(map(str, [ addons_path = ','.join(map(str, filter(None, [
request.config.getoption('--addons-path'), request.config.getoption('--addons-path'),
dummy_addons_path, dummy_addons_path,
])) ])))
cov = [] cov = []
if request.config.getoption('--coverage'): if request.config.getoption('--coverage'):