Skip to content

Commit b8ffc73

Browse files
committed
Make aiosmtpd dependency optional
Move the aiosmtpd dependency to "smtp" extra, and handle the lack of it gracefully in tests. The aiosmtpd package is no longer maintained and had major bugs that lead to it being queued for removal from Gentoo. FWICS all packages in Gentoo that are using pytest-localserver are only using the HTTP support.
1 parent d0dafcf commit b8ffc73

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ def run(self):
3535
python_requires='>=3.5',
3636
install_requires=[
3737
'werkzeug>=0.10',
38-
'aiosmtpd'
3938
],
39+
extras_require={
40+
'smtp': [
41+
'aiosmtpd',
42+
],
43+
},
4044
cmdclass={'test': PyTest},
4145
tests_require=[
4246
'pytest>=2.0.0',

tests/test_smtp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import pytest
12
import smtplib
23

34
try: # python 3
45
from email.mime.text import MIMEText
56
except ImportError: # python 2?
67
from email.MIMEText import MIMEText
78

8-
from pytest_localserver import plugin, smtp
9+
from pytest_localserver import plugin
10+
11+
12+
smtp = pytest.importorskip('pytest_localserver.smtp')
913

1014

1115
def send_plain_email(to, from_, subject, txt, server=('localhost', 25)):

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ deps =
2424
pytest-cov
2525
six
2626
requests
27+
extras =
28+
smtp
2729
commands =
2830
py.test -v \
2931
--junitxml=junit-{envname}.xml \

0 commit comments

Comments
 (0)