From bf4cc09aa427ffda2408b8cfa8d887d4b208ad91 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 20 Nov 2024 12:43:43 +0100 Subject: [PATCH] [IMP] reporting if creating template DB fails Before this, if creating the DB failed the next worker would find themselves with an empty `template-` file, so they would take the path to *create* a template database, which would fail when trying to `mkdir` the `shared-` directory as the directory would already exist. The problem with this is this module would likely immediately fail and take down their worker, triggering a test suite failure for themselves and likely hiding the *true* failure cause (not sure why the originally failed worker isn't the first one to trigger a failure but there you go). By skipping the tests instead, we provide a lot more opportunity for the "true" failure to be revealed. --- conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index d2feca1b..73a07eb4 100644 --- a/conftest.py +++ b/conftest.py @@ -331,7 +331,11 @@ class DbDict(dict): return db d = (self._shared_dir / f'shared-{module}') - d.mkdir() + try: + d.mkdir() + except FileExistsError: + pytest.skip(f"found shared dir for {module}, database creation has likely failed") + self[module] = db = 'template_%s' % uuid.uuid4() subprocess.run([ 'odoo', '--no-http',