[py-svn] commit/pytest: hpk42: allow to run self-tests with "python setup.py test" for pytest tests itself

Bitbucket commits-noreply at bitbucket.org
Sat Oct 20 17:32:33 CEST 2012


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/f5cc42c56496/
changeset:   f5cc42c56496
user:        hpk42
date:        2012-10-20 17:32:03
summary:     allow to run self-tests with "python setup.py test" for pytest tests itself
affected #:  3 files

diff -r 91fc055eea01dd7fabc29df1e826eec5f572591e -r f5cc42c56496ea702d635c6d8a0002ecb629bddc CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,9 @@
 - 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
 -----------------------------------
 


diff -r 91fc055eea01dd7fabc29df1e826eec5f572591e -r f5cc42c56496ea702d635c6d8a0002ecb629bddc _pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
 #
-__version__ = '2.3.2.dev1'
+__version__ = '2.3.2.dev2'


diff -r 91fc055eea01dd7fabc29df1e826eec5f572591e -r f5cc42c56496ea702d635c6d8a0002ecb629bddc setup.py
--- a/setup.py
+++ b/setup.py
@@ -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 @@
         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 @@
     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()

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list