# HG changeset patch # User Goffi # Date 1607081664 -3600 # Node ID f9011d62a87ab208e479b27725e1f25290010c09 # Parent df775db4c49bc5a01b36c78c4327cebbe0a4b10f tests (e2e/conftest): check new exit code for conflict to avoid crashing if test accounts already exist diff -r df775db4c49b -r f9011d62a87a tests/e2e/conftest.py --- 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)