Skip to content

Commit

Permalink
chore(dependencies): unpin pytest version, use pytest-runner (TheKevJ…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames authored Feb 22, 2017
1 parent 911adf6 commit 5a866c2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.egg-info
dist
build
.eggs
eggs
parts
var
Expand Down
9 changes: 7 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Example of tox.ini::

[testenv]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
deps =
coveralls
commands =
coverage run --source=yourpackagename setup.py test
Expand Down Expand Up @@ -152,7 +152,7 @@ To exclude parts of your source from coverage, for example migrations folders::
[report]
omit = */migrations/*

Some lines are never executed in your tests, but that can be ok.
Some lines are never executed in your tests, but that can be ok.
To mark those lines use inline comments right in your source code::

if debug: # pragma: no cover
Expand Down Expand Up @@ -219,3 +219,8 @@ Run tests::

$ python setup.py test

Or, even better, use `tox`_::

$ tox

.. _`tox`: http://tox.readthedocs.io/en/latest/index.html
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[aliases]
test=pytest

[wheel]
universal = 1
19 changes: 4 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import sys
from setuptools.command.test import test as TestCommand
from setuptools import setup


class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
DESCRIPTION = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read()


setup(
Expand All @@ -24,18 +13,18 @@ def run_tests(self):
author='Ilya Baryshev',
author_email='baryshev@gmail.com',
description='Show coverage stats online via coveralls.io',
long_description=open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read(),
long_description=DESCRIPTION,
entry_points={
'console_scripts': [
'coveralls = coveralls.cli:main',
],
},
install_requires=['docopt>=0.6.1', 'coverage>=3.6', 'requests>=1.0.0'],
tests_require=['mock', 'pytest>=2.7.3,<2.8', 'sh>=1.08'],
setup_requires=['pytest-runner'],
tests_require=['mock', 'pytest', 'sh>=1.08'],
extras_require={
'yaml': ['PyYAML>=3.10']
},
cmdclass={'test': PyTest},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Testing',
Expand Down
5 changes: 2 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# coding: utf-8
import os
import sys

from mock import patch, call
import pytest

import coveralls
from coveralls.api import CoverallsException
Expand Down Expand Up @@ -33,7 +31,8 @@ def test_debug_no_token(mock_wear, mock_log):
def test_real(mock_wear, mock_log):
coveralls.cli.main(argv=[])
mock_wear.assert_called_with()
mock_log.assert_has_calls([call("Submitting coverage to coveralls.io..."), call("Coverage submitted!")])
mock_log.assert_has_calls([call("Submitting coverage to coveralls.io..."),
call("Coverage submitted!")])


@patch.dict(os.environ, {'TRAVIS': 'True'}, clear=True)
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ envlist = py{27,33,34,35,py,py3,py-54,py33-52-alpha1}-cov{3,4,41}-{default,pyyam
passenv = *
usedevelop = true
deps =
pytest>=2.7.3,<2.8
mock
pytest
pytest-runner
sh
pyyaml: PyYAML>=3.10
cov3: coverage<4.0
Expand Down

0 comments on commit 5a866c2

Please sign in to comment.