Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
Merge branch 'update-deps'
Browse files Browse the repository at this point in the history
* update-deps:
  Make setup.py not depend on the code being set up
  Update import logic to better work with python 3
  Update author email
  Fix python lint issues
  Move requirements definitions around
  Add coverage package
  Delete tox, codecov, codeclimate-test-reporter
  • Loading branch information
albertyw committed Jan 27, 2020
2 parents eecc972 + b7812fe commit 8e4e0ca
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 55 deletions.
1 change: 0 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ engines:
enabled: true
ratings:
paths:
- "tests"
- "mailgun2"
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
source=.
omit =
setup.py
12 changes: 4 additions & 8 deletions mailgun2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
__title__ = 'mailgun2'
__version__ = '1.1.0'
__author__ = 'Albert Wang'
__license__ = 'Apache 2.0'
from __future__ import absolute_import

try:
from .mailgun import Mailgun
except:
pass
from .__version__ import __version__ # noqa: F401

from .mailgun import Mailgun # noqa: F401
3 changes: 3 additions & 0 deletions mailgun2/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VERSION = (1, 1, 0)

__version__ = '.'.join(map(str, VERSION))
7 changes: 6 additions & 1 deletion mailgun2/mailgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,9 @@ def verify_authenticity(self, token, timestamp, signature):
def validate(self, address):
params = {'address': address}
auth = ('api', self.public_key)
return self.get('/address/validate', params=params, auth=auth, include_domain=False)
return self.get(
'/address/validate',
params=params,
auth=auth,
include_domain=False,
)
File renamed without changes.
13 changes: 9 additions & 4 deletions tests/mailgun.py → mailgun2/tests/mailgun.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import absolute_import
import os
import unittest

from mock import patch, MagicMock
from mock import patch

import mailgun2
from .. import Mailgun


class MailgunTestBase(unittest.TestCase):
Expand All @@ -12,7 +13,11 @@ def setUp(self):
self.public_key = 'test_public_key'
self.private_key = 'test_private_key'
self.domain = 'test.domain'
self.mailgun = mailgun2.Mailgun(self.domain, self.public_key, self.private_key)
self.mailgun = Mailgun(
self.domain,
self.public_key,
self.private_key,
)
self.post_patcher = patch('mailgun2.mailgun.requests.post')
self.mock_post = self.post_patcher.start()

Expand Down Expand Up @@ -90,7 +95,7 @@ def test_headers(self):

def test_inlines_attachments(self):
current_path = os.path.abspath(os.path.dirname(__file__))
license_file = current_path + '/../LICENSE'
license_file = current_path + '/../../LICENSE'
self.mailgun.send_message(
'from@example.com',
'to@example.com',
Expand Down
5 changes: 5 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Testing
coverage==5.0.3 # Test coverage
flake8==3.7.9 # Python linting
mock==3.0.5 # Test mocking and patching
mypy==0.761 # Static typing
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

50 changes: 27 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
#!/usr/bin/env python
from setuptools import setup
import mailgun2
# -*- coding: utf-8 -*-

try:
readme = open("README.rst")
long_description = str(readme.read())
finally:
readme.close()
from setuptools import setup, find_packages
from codecs import open
from os import path


# Get the long description from the README file
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

about = {}
with open(path.join(here, 'mailgun2', '__version__.py')) as f:
exec(f.read(), about)

download_url = ("https://github.com/albertyw/python-mailgun2/"
"archive/%s.tar.gz") % mailgun2.__version__

setup(
name=mailgun2.__title__,
packages=[mailgun2.__title__],
version=mailgun2.__version__,
name='mailgun2',
packages=find_packages(exclude=['tests']),
version=about['__version__'],
description='A python client for Mailgun API v2',
long_description=long_description,
author=mailgun2.__author__,
author_email='albertyw@mit.edu',
author='Albert Wang',
author_email='git@albertyw.com',
url='https://github.com/albertyw/python-mailgun2',
download_url=download_url,
keywords=['mailgun', 'email'],
install_requires=[
'requests>=2.6',
'requests>=2.6,<3.0',
],
license='Apache',
test_suite="tests",
tests_require=[
'codecov>=1.6',
'mock>=0.8',
'codeclimate-test-reporter',
'tox>=2.3'
],
test_suite="mailgun2.tests",
# testing requires flake8 and coverage but they're listed separately
# because they need to wrap setup.py
extras_require={
'dev': [],
'test': [],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
Expand Down
17 changes: 0 additions & 17 deletions tox.ini

This file was deleted.

0 comments on commit 8e4e0ca

Please sign in to comment.