Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup.py and test flow #403

Merged
merged 1 commit into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
source = stripe
omit =
stripe/six.py
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude =
six.py
20 changes: 2 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,14 @@ python:
- "pypy3"

cache:
apt: true
directories:
- stripe-mock
pip: false

env:
global:
- PYCURL_SSL_LIBRARY=gnutls
- STRIPE_MOCK_VERSION=0.8.0

addons:
apt:
packages:
- libcurl4-gnutls-dev
- librtmp-dev

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
- |
Expand All @@ -41,20 +33,12 @@ before_install:
STRIPE_MOCK_PID=$!

install:
- pip install -U setuptools pip
- pip install pycurl flake8 coveralls
- python setup.py clean --all
- pip install -U setuptools pip flake8 coveralls
- python setup.py install

script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then flake8 stripe tests; fi
- python -W all -bb -W error::BytesWarning setup.py test --addopts "--cov=stripe"
- python setup.py test -a "-n 8"

after_success:
coveralls

matrix:
allow_failures:
- python: 3.7-dev
- python: pypy
- python: pypy3
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = -p no:warnings
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[aliases]
test=pytest

[bdist_wheel]
universal = 1

Expand Down
49 changes: 35 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import os
import sys
from codecs import open
from os import path
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]

path, script = os.path.split(sys.argv[0])
os.chdir(os.path.abspath(path))
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = '-n auto'

with open('LONG_DESCRIPTION.rst') as f:
def run_tests(self):
import shlex
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)


here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'LONG_DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()

version_contents = {}
with open(os.path.join('stripe', 'version.py')) as f:
with open(path.join(here, 'stripe', 'version.py'), encoding='utf-8') as f:
exec(f.read(), version_contents)

setup(
Expand All @@ -26,18 +37,27 @@
author_email='support@stripe.com',
url='https://github.com/stripe/stripe-python',
license='MIT',
packages=['stripe', 'stripe.api_resources',
'stripe.api_resources.abstract'],
keywords='stripe api payments',
packages=find_packages(exclude=['tests', 'tests.*']),
package_data={'stripe': ['data/ca-certificates.crt']},
zip_safe=False,
install_requires=[
'requests >= 0.8.8',
'requests >= 2',
'requests[security] >= 2; python_version < "3.0"',
],
setup_requires=['pytest-runner'],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
tests_require=[
'pytest >= 3.4',
'pytest-mock >= 1.7',
'pytest-xdist >= 1.22',
'pytest-cov >= 2.5',
],
cmdclass={'test': PyTest},
project_urls={
'Bug Tracker': 'https://github.com/stripe/stripe-python/issues',
'Documentation': 'https://stripe.com/docs/api/python',
'Source Code': 'https://github.com/stripe/stripe-python',
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -52,4 +72,5 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
])
],
)
22 changes: 2 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,12 @@
envlist = py27, py34, py35, py36, pypy, pypy3

[testenv]
deps =
pycurl>=7.19
requests>=0.8.8
commands =
python setup.py clean --all
python -W all -bb -W error::BytesWarning setup.py test --addopts "--cov=stripe {posargs}"
setenv =
STRIPE_TEST_PYCURL = true
python setup.py test -a "{posargs:-n auto}"

[testenv:py27]
deps =
flake8
pycurl>=7.19
requests>=0.8.8
commands =
flake8 stripe tests
python setup.py clean --all
python -W all -bb -W error::BytesWarning setup.py test --addopts "--cov=stripe {posargs}"

[flake8]
exclude =
six.py

[coverage:run]
source = stripe
omit =
stripe/six.py
python setup.py test -a "{posargs:-n auto}"