diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index fe51b5bd..0d55817d 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -25,6 +25,7 @@ from pathlib import Path 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 @@ def test_profiles(): 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)