Mercurial > libervia-backend
changeset 3436:f9011d62a87a
tests (e2e/conftest): check new exit code for conflict to avoid crashing if test accounts already exist
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 04 Dec 2020 12:34:24 +0100 |
parents | df775db4c49b |
children | 42d6d00e4e8a |
files | tests/e2e/conftest.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/e2e/conftest.py Fri Dec 04 12:32:56 2020 +0100 +++ b/tests/e2e/conftest.py Fri Dec 04 12:34:24 2020 +0100 @@ -25,6 +25,7 @@ from aiosmtpd.controller import Controller from aiosmtpd.handlers import Message from email.message import EmailMessage +import sh from sh import jp import pytest @@ -155,12 +156,17 @@ profile_suff = f"_s{server_idx}" if server_idx>1 else "" profile = f"account{account_idx}{profile_suff}" profiles.append(profile) - jp.account.create( - f"account{account_idx}@server{server_idx}.test", - "test", - profile=profile, - host=f"server{server_idx}.test" - ) + try: + jp.account.create( + f"account{account_idx}@server{server_idx}.test", + "test", + profile=profile, + host=f"server{server_idx}.test" + ) + except sh.ErrorReturnCode_19: + # this is the conlict exit code, this can happen when tests are run + # inside a container when --keep-profiles is used with run_e2e.py. + pass jp.profile.modify(profile="account1", default=True, connect=True) jp.profile.connect(profile="account1_s2", connect=True) yield tuple(profiles)