diff options
| author | Andreas Pelme | 2014-03-02 12:40:30 +0100 | 
|---|---|---|
| committer | Andreas Pelme | 2014-03-02 12:40:30 +0100 | 
| commit | 971578ca345c3d3bae7fd93b87c41d43483b6f05 (patch) | |
| tree | 72a6d3d0ced5750a8ba01bedc3a6f8a936e05e2f /setup.py | |
| parent | 62786a7ad64918022f11f1b95ce84adb8d798830 (diff) | |
| download | django-rest-framework-971578ca345c3d3bae7fd93b87c41d43483b6f05.tar.bz2 | |
Support for running the test suite with py.test
 * Get rid of runtests.py
 * Moved test code  from rest_framework/tests and rest_framework/runtests to tests
 * Invoke py.test from setup.py
 * Invoke py.test from Travis
 * Invoke py.test from tox
 * Changed setUpClass to be just plain setUp in test_permissions.py
 * Updated contribution guideline to show how to invoke py.test
Diffstat (limited to 'setup.py')
| -rwxr-xr-x | setup.py | 17 | 
1 files changed, 16 insertions, 1 deletions
| @@ -2,11 +2,26 @@  # -*- coding: utf-8 -*-  from setuptools import setup +from setuptools.command.test import test as TestCommand  import re  import os  import sys +# This command has been borrowed from +# https://github.com/getsentry/sentry/blob/master/setup.py +class PyTest(TestCommand): +    def finalize_options(self): +        TestCommand.finalize_options(self) +        self.test_args = ['tests'] +        self.test_suite = True + +    def run_tests(self): +        import pytest +        errno = pytest.main(self.test_args) +        sys.exit(errno) + +  def get_version(package):      """      Return package version as listed in `__version__` in `init.py`. @@ -62,7 +77,7 @@ setup(      author_email='tom@tomchristie.com',  # SEE NOTE BELOW (*)      packages=get_packages('rest_framework'),      package_data=get_package_data('rest_framework'), -    test_suite='rest_framework.runtests.runtests.main', +    cmdclass={'test': PyTest},      install_requires=[],      classifiers=[          'Development Status :: 5 - Production/Stable', | 
