|
1 | | -import os |
| 1 | +import os, sys |
2 | 2 | from setuptools import find_packages, setup |
3 | 3 |
|
4 | 4 | with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: |
5 | 5 | README = readme.read() |
6 | 6 |
|
| 7 | +try: |
| 8 | + from setuptools.command.test import test as TestCommand |
| 9 | + |
| 10 | + class PyTest(TestCommand): |
| 11 | + user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")] |
| 12 | + |
| 13 | + def initialize_options(self): |
| 14 | + TestCommand.initialize_options(self) |
| 15 | + self.pytest_args = [] |
| 16 | + |
| 17 | + def finalize_options(self): |
| 18 | + TestCommand.finalize_options(self) |
| 19 | + self.test_args = [] |
| 20 | + self.test_suite = True |
| 21 | + |
| 22 | + def run_tests(self): |
| 23 | + import pytest |
| 24 | + |
| 25 | + errno = pytest.main(self.pytest_args) |
| 26 | + sys.exit(errno) |
| 27 | + |
| 28 | +except ImportError: |
| 29 | + PyTest = None |
| 30 | + |
| 31 | +cmdclasses = {} |
| 32 | +if PyTest: |
| 33 | + cmdclasses['test'] = PyTest |
| 34 | + |
7 | 35 | # allow setup.py to be run from any path |
8 | 36 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) |
9 | 37 |
|
|
18 | 46 | description='A set of helper functions and utilities for a Django application', |
19 | 47 | download_url = 'https://github.com/codezeus/django-toolset/tarball/0.1.3', |
20 | 48 | long_description=README, |
| 49 | + cmdclass=cmdclasses, |
21 | 50 | url='https://github.com/codezeus/django-toolset', |
22 | | - author='Dan Sackett', |
23 | | - author_email='danesackett@gmail.com', |
24 | | - tests_require=['Django', 'pytest', 'coverage', 'mock'], |
| 51 | + author='CodeZeus', |
| 52 | + maintainer='Dan Sackett', |
| 53 | + maintainer_email='danesackett@gmail.com', |
| 54 | + tests_require=['Django', 'pytest', 'pytest-cov', 'coverage', 'mock'], |
25 | 55 | classifiers=[ |
26 | 56 | 'Environment :: Web Environment', |
27 | 57 | 'Framework :: Django', |
|
32 | 62 | 'Programming Language :: Python', |
33 | 63 | 'Programming Language :: Python :: 2', |
34 | 64 | 'Programming Language :: Python :: 2.7', |
35 | | - 'Topic :: Internet :: WWW/HTTP', |
36 | | - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content' |
| 65 | + 'Topic :: Utilities', |
37 | 66 | ], |
38 | 67 | ) |
0 commit comments