Skip to content

Commit 5b517f5

Browse files
committed
Updated setup.py test to use PyTest
1 parent 109f44c commit 5b517f5

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ omit =
33
tests/*
44
.tox/*
55
setup.py
6+
*.egg/*

setup.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@
66
import jwt
77

88
from setuptools import setup
9+
from setuptools.command.test import test
10+
11+
12+
class PyTest(test):
13+
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
14+
15+
def initialize_options(self):
16+
test.initialize_options(self)
17+
self.pytest_args = []
18+
19+
def finalize_options(self):
20+
test.finalize_options(self)
21+
self.test_args = []
22+
self.test_suite = True
23+
24+
def run_tests(self):
25+
# import here, cause outside the eggs aren't loaded
26+
import pytest
27+
errno = pytest.main(['.'] + self.pytest_args)
28+
sys.exit(errno)
929

1030

1131
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
@@ -57,5 +77,7 @@ def get_packages(package):
5777
'Programming Language :: Python :: 3.4',
5878
'Topic :: Utilities',
5979
],
60-
test_suite='tests'
80+
test_suite='tests',
81+
tests_require=['pytest', 'pytest-cov'],
82+
cmdclass={'test': PyTest},
6183
)

0 commit comments

Comments
 (0)