From 665835e9a7f8595b644acb704a8751cd37120d6d Mon Sep 17 00:00:00 2001 From: androiddrew Date: Fri, 26 Jan 2018 15:28:23 -0500 Subject: [PATCH] Added support for coverage and tox --- .coveragerc | 3 +++ README.md | 16 +++++++++++++++- setup.py | 14 +++++--------- tests/test_apistar_mail.py | 4 ++-- tox.ini | 5 +++++ 5 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 .coveragerc create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..db00c26 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,3 @@ +[run] +source = apistar_mail +omit = test* \ No newline at end of file diff --git a/README.md b/README.md index 3ada873..04a3e4d 100644 --- a/README.md +++ b/README.md @@ -83,4 +83,18 @@ A Message can contain a body and/or HTML: ``` msg.body = 'message body' msg.html = 'Hello apistar_mail!' -``` \ No newline at end of file +``` + +## Testing + +To run the test suite with coverage first install the package in editable mode with it's testing requirements: + +`pip install -e ".[testing]"` + +To run the project's tests + +`pytest --cov` + +To run tests against multiple python interpreters use: + +`tox` \ No newline at end of file diff --git a/setup.py b/setup.py index 597f7b9..f1e1f2a 100644 --- a/setup.py +++ b/setup.py @@ -10,13 +10,10 @@ requirements = [ 'apistar', ] -setup_requirements = [ - 'pytest-runner', -] - test_requirements = [ 'pytest', - 'coverage', + 'pytest-cov', + 'tox' ] setup( @@ -38,11 +35,10 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', - 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], - test_suite='tests', - tests_require=test_requirements, - setup_requires=setup_requirements, + extras_require={ + 'testing': test_requirements, + } ) diff --git a/tests/test_apistar_mail.py b/tests/test_apistar_mail.py index a63cda5..f70ec3f 100644 --- a/tests/test_apistar_mail.py +++ b/tests/test_apistar_mail.py @@ -1,10 +1,10 @@ -from apistar_mail.mail import Message, Mailer, force_text +from apistar_mail.mail import Message, Mail, force_text from apistar_mail.exc import MailUnicodeDecodeError import pytest settings = { - 'EMAIL': { + 'MAIL': { 'MAIL_SERVER': 'smtp.example.com', 'MAIL_USERNAME': 'fake@example.com', 'MAIL_PASSWORD': 'secret', diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..87d37fc --- /dev/null +++ b/tox.ini @@ -0,0 +1,5 @@ +[tox] +envlist = py35,py36 +[testenv] +deps=pytest +commands=pytest