[py-dev] setuptools
Joan Miller
peloko45 at gmail.com
Mon Feb 1 17:14:12 CET 2010
The ideal would be to pass a collector to the option 'test_suite' in
setuptools, i.e. for nose [1] is used:
test_suite = "nose.collector",
This way has been added too to Pip [2]. Here the info. about that option [3]
[1] http://somethingaboutorange.com/mrl/projects/nose/0.11.1/setuptools_integration.html
[2] http://ericholscher.com/blog/2009/nov/5/adding-testing-pip/
[3] http://peak.telecommunity.com/DevCenter/setuptools#test
2010/2/1 holger krekel <holger at merlinux.eu>:
> 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 py-dev
mailing list