Skip to content

Commit

Permalink
Use pipenv for managing developement virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Jul 9, 2018
1 parent 795a5dd commit ddb8a85
Show file tree
Hide file tree
Showing 7 changed files with 418 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ before_install:
STRIPE_MOCK_PID=$!
install:
- pip install -U setuptools pip flake8 coveralls
- python setup.py install
- pip install --upgrade pipenv
- pipenv install --dev

script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then flake8 stripe tests; fi
- python setup.py test -a "-n 8"
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then make lint; fi
- make ci

after_success:
coveralls
make coveralls
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test:
pipenv run detox

ci:
pipenv run pytest --cov=stripe -n 8

coveralls:
pipenv run coveralls

lint:
pipenv run tox -e lint
27 changes: 27 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

"stripe" = {path = ".", editable = true}


[dev-packages]

pytest = ">=3.4"
pytest-mock = ">=1.7"
pytest-xdist = ">=1.22"
pytest-cov = ">=2.5"
tox = "*"
detox = "*"
"flake8" = "*"
coveralls = "*"


[requires]

python_version = "3.7"
347 changes: 347 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,37 @@ instructions for installing via Homebrew and other methods):
go get -u github.com/stripe/stripe-mock
stripe-mock

Tests are managed by `tox`. Install using `pip`
Install [pipenv][pipenv], then install all dependencies for the project:

pip install tox
pipenv install --dev

Run all tests (modify `-e` according to your Python target):
Run all tests on all supported Python versions:

tox -e py27
make test

Run all tests for a specific Python version (modify `-e` according to your Python target):

pipenv run tox -e py27

Run all tests in a single file:

tox -e py27 -- tests/api_resources/abstract/test_updateable_api_resource.py

Run a single test suite:

tox -e py27 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource
pipenv run tox -e py27 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource

Run a single test:

tox -e py27 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save
pipenv run tox -e py27 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save

Run the linter with:

pip install flake8
flake8 stripe tests
make lint

[api-keys]: https://dashboard.stripe.com/account/apikeys
[connect]: https://stripe.com/connect
[pipenv]: https://github.com/pypa/pipenv
[stripe-mock]: https://github.com/stripe/stripe-mock

<!--
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


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

def initialize_options(self):
TestCommand.initialize_options(self)
Expand Down
24 changes: 15 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py34, py35, py36, pypy, pypy3
envlist = py27,
py34,
py35,
py36,
pypy,
pypy3,
lint
skip_missing_interpreters = true

[testenv]
commands =
python setup.py test -a "{posargs:-n auto}"
description = run the unit tests under {basepython}
commands = python setup.py test -a "{posargs:-n auto}"

[testenv:py27]
deps =
flake8
commands =
flake8 stripe tests
python setup.py test -a "{posargs:-n auto}"
[testenv:lint]
description = run static analysis and style check using flake8
basepython = python2.7
deps = flake8
commands = python -m flake8 --show-source stripe tests setup.py {posargs}

0 comments on commit ddb8a85

Please sign in to comment.