Skip to content

Commit 1e46bba

Browse files
author
Kenneth Reitz
committed
setup.py test runner
1 parent dd567b3 commit 1e46bba

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

setup.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@
4646
about["__version__"] = VERSION
4747

4848

49+
class TestCommand(Command):
50+
"""Support setup.py test."""
51+
52+
description = "Test the package."
53+
user_options = []
54+
55+
@staticmethod
56+
def status(s):
57+
"""Prints things in bold."""
58+
print("\033[1m{0}\033[0m".format(s))
59+
60+
def initialize_options(self):
61+
pass
62+
63+
def finalize_options(self):
64+
pass
65+
66+
def run(self):
67+
os.system("{0} -m pytest".format(sys.executable))
68+
sys.exit()
69+
4970
class UploadCommand(Command):
5071
"""Support setup.py upload."""
5172

@@ -129,5 +150,6 @@ def run(self):
129150
# $ setup.py publish support.
130151
cmdclass={
131152
"upload": UploadCommand,
153+
"test": TestCommand
132154
},
133155
)

0 commit comments

Comments
 (0)