Skip to content

Commit 5950014

Browse files
authored
Merge pull request #40 from mgorny/aiosmtpd-dep
Make aiosmtpd dependency optional
2 parents d0dafcf + b85b4df commit 5950014

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
matrix:
1212
# Not all Python versions are available for linux AND x64
1313
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
14-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10']
14+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11.0-beta - 3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
15+
extra: ['', '-smtp']
1516
fail-fast: false
1617

1718
steps:
@@ -23,6 +24,6 @@ jobs:
2324
- name: Install dependencies
2425
run: |
2526
python -m pip install --upgrade pip
26-
pip install tox tox-gh-actions
27+
pip install tox
2728
- name: Test with tox
28-
run: tox -vv
29+
run: tox -vv -e py${{ matrix.extra }}

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ def run(self):
2727
maintainer='David Zaslavsky',
2828
maintainer_email='[email protected]',
2929
license='MIT License',
30-
description='py.test plugin to test server connections locally.',
30+
description='pytest plugin to test server connections locally.',
3131
long_description=read('README.rst'),
3232
url='https://github.com/pytest-dev/pytest-localserver',
3333

3434
packages=['pytest_localserver'],
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',
@@ -49,7 +53,7 @@ def run(self):
4953
zip_safe=False,
5054
include_package_data=True,
5155

52-
keywords='py.test pytest server localhost http smtp',
56+
keywords='pytest server localhost http smtp',
5357
classifiers=[
5458
'Framework :: Pytest',
5559
'Operating System :: OS Independent',

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: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
[tox]
2-
envlist = py35,py36,py37,py38,py39,py310
2+
envlist = py{35,36,37,38,39,310,311,py3}{,-smtp}
33
recreate = True
44
isolated_build = True
55

66
[tox:hudson]
77
downloadcache = {toxworkdir}/_download
88

9-
[gh-actions]
10-
python =
11-
3.5: py35
12-
3.6: py36
13-
3.7: py37
14-
3.8: py38
15-
3.9: py39
16-
3.10: py310
17-
189
[testenv]
1910
description = run test suite under {basepython}
2011
deps =
@@ -24,7 +15,9 @@ deps =
2415
pytest-cov
2516
six
2617
requests
18+
extras =
19+
smtp: smtp
2720
commands =
28-
py.test -v \
21+
pytest -v \
2922
--junitxml=junit-{envname}.xml \
3023
{posargs}

0 commit comments

Comments
 (0)