-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Marius Gedminas wrote:
On Thu, Sep 18, 2008 at 12:42:33AM +0200, Philipp von Weitershausen wrote:
Marius Gedminas wrote:
On Wed, Sep 17, 2008 at 12:52:49PM -0400, Tres Seaver wrote:
$ ../bin/python setup.py test # [2] # Runs egg_info, installs regular and testing dependencies, and # runs all unit (non-layer) tests I don't like the idea that running the tests installs additional packages into my environment without me explicitly asking for it. You *are* asking for it by running python setup.py test.
I think I got confused (again) by the difference by setuptools and distutils.
setuptools has a 'setup.py test' that installs dependencies and runs tests.
distutils doesn't have a 'setup.py test' at all.
For some reason I thought 'setup.py test' was a distutils thing that didn't know anything about dependencies, and that people who use it were used it not changing the environment.
My mistake.
Also, python setup.py test doesn't actually install testing dependencies (or any dependencies for that matter) into site-packages. It just dumps them into the CWD.
I don't mind that.
I looked again at the patch to the setup.py, and saw some whitespace fixups in it. Here is the diff for another pacakge without any "housekeeping": - ------------------------- %< ----------------------------------- - --- setup.py (revision 91225) +++ setup.py (working copy) @@ -42,14 +42,22 @@ include_package_data=True, namespace_packages=['Products'], zip_safe=False, + setup_requires=['eggtestinfo', + ], install_requires=[ #'Zope >= 2.10.4', 'setuptools', 'five.localsitemanager>=0.3', 'Products.GenericSetup', ], + tests_require=['zope.testing', + ], + test_loader='zope.testing.testrunner.eggsupport:SkipLayers', + test_suite='Products.%s.tests' % NAME, entry_points=""" [zope2.initialize] Products.%s = Products.%s:initialize + [distutils.commands] + ftest = zope.testing.testrunner.eggsupport:ftest """ % (NAME, NAME), ) - ------------------------- %< ----------------------------------- - - The first change is not strictly required, but it does get the 'test*' attributes captured in a separate file in the EGG-INFO directory, which makes it at least theoretically possible to run the tests from a binary egg (not that I ever use them). - - The second is what allows 'setup.py test' to work, running only the non-layer tests. The 'tests_require' part gets zope.testing downloaded and on the path before looking for the loader specified in 'test_loader'. That loader then gets passed the 'test_suite' string. - - The last section of the diff is what gets a new command available ('setup.py ftest'). That is the part which runs all the tests, both unit and functional. If we chose to make the entry point 'test' instead of 'ftest', then we could leave out the middle section, but would need to make 'zope.testing' a 'setup_requires' dependency. That case is also the one where running from a fresh checkout requires 'setup.py egg_info' first, or else the old testrunner gets used the first time. I think that we are OK for distributed tarballs, because they contain the '.egg-info' directory generated during 'sdist'. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI0j71+gerLs4ltQ4RAkLGAJ0cHcqrl5AnA6rimuTn9iZyDeuGCACguAJt wn27D9G/UimUZzcLwUWSncA= =GVVI -----END PGP SIGNATURE-----