[py-dev] setuptools
holger krekel
holger at merlinux.eu
Mon Feb 1 15:30:15 CET 2010
On Mon, Feb 01, 2010 at 12:22 +0000, Joan Miller wrote:
> Are there plans for the integration with setuptools/distribute?
>
> So I would that py.test were run using *python setup.py py.test* or
> anything so, as is made with nosetools
I've seen some discussions, haven't played much with it myself yet.
Googled a bit and came up with the below patch to one of my
(non-py) packages. With it I could successfully do:
python setup.py test # will run "py.test"
and it would also take care to temporarily install "py" just for the
testing and not as a general dependency. Happy to hear if this works
for you and others as well.
cheers,
holger
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -3,6 +3,7 @@ if sys.version_info >= (3,0):
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
+from setuptools.command.test import test
long_description = """
ciss: code-centered single-file "ISSUES.txt" issue tracking
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
author='holger krekel',
author_email='holger at merlinux.eu',
+ cmdclass = {'test': PyTest},
+ tests_require = ['py'],
entry_points={'console_scripts': [
'ciss = ciss:main',
]},
@@ -39,6 +42,15 @@ def main():
zip_safe=False,
)
+class PyTest(test):
+ user_options = []
+ def initialize_options(self):
+ test.initialize_options(self)
+ self.test_suite = "."
+ def run_tests(self):
+ import py
+ py.cmdline.pytest(['.'])
+
if __name__ == '__main__':
main()
More information about the Pytest-dev
mailing list