allow to run self-tests with "python setup.py test" for pytest tests itself

This commit is contained in:
holger krekel 2012-10-20 17:32:03 +02:00
parent c894b2b459
commit 720fe3405b
3 changed files with 21 additions and 4 deletions

View File

@ -4,6 +4,9 @@ Changes between 2.3.1 and 2.3.2.dev
- add tox.ini to pytest distribution so that ignore-dirs and others config
bits are properly distributed for maintainers who run pytest-own tests
- add some logic to setup.py such that "python setup.py test" works with
pytest itself
Changes between 2.3.0 and 2.3.1
-----------------------------------

View File

@ -1,2 +1,2 @@
#
__version__ = '2.3.2.dev1'
__version__ = '2.3.2.dev2'

View File

@ -1,10 +1,10 @@
import os, sys
try:
from setuptools import setup
from setuptools import setup, Command
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from setuptools import setup, Command
long_description = """
cross-project testing tool for Python.
@ -24,13 +24,14 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.3.2.dev1',
version='2.3.2.dev2',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='Holger Krekel, Benjamin Peterson, Ronny Pfannschmidt, Floris Bruynooghe and others',
author_email='holger at merlinux.eu',
entry_points= make_entry_points(),
cmdclass = {'test': PyTest},
# the following should be enabled for release
install_requires=['py>=1.4.10'],
classifiers=['Development Status :: 6 - Mature',
@ -69,5 +70,18 @@ def make_entry_points():
l = ["%s = %s" % (x, points[x]) for x in keys]
return {'console_scripts': l}
class PyTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys,subprocess
os.environ["PYTHONPATH"] = os.environ["PYTHONPATH"] + ":" + os.getcwd()
errno = subprocess.call([sys.executable, 'pytest.py'])
raise SystemExit(errno)
if __name__ == '__main__':
main()