Skip to content

Commit

Permalink
unit tests are now blended with statement and branch coverage. If
Browse files Browse the repository at this point in the history
coverage drops, tests will now fail. The coverage threshold will raise
as we get more code under test.
  • Loading branch information
kavdev committed May 1, 2015
1 parent 7586190 commit 2443ec2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[run]
source = djstripe
branch = True
omit =
djstripe/migrations/*
djstripe/south_migrations/*
djstripe/management/*
djstripe/admin.py
djstripe/admin.py
djstripe/*__init__.py

[html]
directory = "htmlcoverage"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ logfile
pip-log.txt

# Unit test / coverage reports
cover/*
.coverage
.tox
nosetests.xml
Expand Down
10 changes: 3 additions & 7 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Ready to contribute? Here's how to set up `dj-stripe` for local development.
Now you can make your changes locally.

6. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
tests, including testing other Python versions with tox. If your changes cause code
coverage to drop, the tests will fail.::

$ pip install -r requirements_test.txt
$ flake8 djstripe tests
Expand All @@ -94,12 +95,7 @@ tests, including testing other Python versions with tox::

To get flake8 and tox, just pip install them into your virtualenv.

7. Check the test coverage report. Make sure coverage hasn't dropped::

$ coverage run --source djstripe runtests.py
$ coverage report -m

8. Commit your changes and push your branch to GitHub::
7. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
Expand Down
11 changes: 8 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
),
SITE_ID=1,
STRIPE_PUBLIC_KEY=os.environ.get("STRIPE_PUBLIC_KEY", ""),
STRIPE_SECRET_KEY=os.environ.get("STRIPE_SECRET_KEY", ""),
STRIPE_PUBLIC_KEY=os.environ.get("STRIPE_PUBLIC_KEY", "pk_test_lOasUMgiIA701U9wZnL6Zo6a"),
STRIPE_SECRET_KEY=os.environ.get("STRIPE_SECRET_KEY", "sk_test_nZBY1yjOJ75iFKGjorN29GiA"),
DJSTRIPE_PLANS={},
DJSTRIPE_SUBSCRIPTION_REQUIRED_EXCEPTION_URLS=(
"(admin)",
Expand All @@ -46,7 +46,12 @@
),
TEMPLATE_DIRS = [
os.path.join(TESTS_ROOT, "tests/templates"),
]
],
NOSE_ARGS = ['--with-coverage',
'--cover-branches',
'--cover-html',
'--cover-package=djstripe',
'--cover-min-percentage=64']
)

# Avoid AppRegistryNotReady exception
Expand Down

0 comments on commit 2443ec2

Please sign in to comment.