New submission from Tres Seaver <tsea...@palladion.com>:

The attached patch adds a '--with-test-requirements' / '-t' option to the 
'develop' command:  the rationale is that when developing a package, one should
be able to run the tests without polluting the local checkout directory with
the eggs specified by its 'tests_require':  those eggs should be installed just
as the other ones mandated by 'install_requires'.

I would actually prefer to make this behavior the default, perhaps with a
command-line-switch to disable it, but think that backward compatibility
trumps that itch.

----------
assignedto: pje
files: setuptools-0.6-develop-with_test_requirements.patch
messages: 606
nosy: pje, tseaver
priority: feature
status: unread
title: Add support for installing test requirements to 'develop' command
Added file: 
http://bugs.python.org/setuptools/file76/setuptools-0.6-develop-with_test_requirements.patch

_______________________________________________
Setuptools tracker <setupto...@bugs.python.org>
<http://bugs.python.org/setuptools/issue124>
_______________________________________________
=== modified file 'EasyInstall.txt'
--- EasyInstall.txt	2011-03-23 21:09:16 +0000
+++ EasyInstall.txt	2011-03-28 14:42:42 +0000
@@ -1218,6 +1218,8 @@
 ============================
 
 0.6final
+ * Added ``--with-test-requirements`` flag to the 'develop' command.
+
  * Fixed AttributeError under Python 2.3 when processing "HTTP authentication"
    URLs (i.e., ones with a ``user:password@host``).
 

=== modified file 'setuptools/command/develop.py'
--- setuptools/command/develop.py	2008-01-19 02:55:03 +0000
+++ setuptools/command/develop.py	2011-03-28 14:40:10 +0000
@@ -13,6 +13,7 @@
     user_options = easy_install.user_options + [
         ("uninstall", "u", "Uninstall this source package"),
         ("egg-path=", None, "Set the path to be used in the .egg-link file"),
+        ("with-test-requirements", "t", "Install test requirements"),
     ]
 
     boolean_options = easy_install.boolean_options + ['uninstall']
@@ -30,6 +31,7 @@
     def initialize_options(self):
         self.uninstall = None
         self.egg_path = None
+        self.with_test_requirements = False
         easy_install.initialize_options(self)
         self.setup_path = None
         self.always_copy_from = '.'   # always copy eggs installed in curdir
@@ -100,6 +102,10 @@
         # postprocess the installed distro, fixing up .pth, installing scripts,
         # and handling requirements
         self.process_distribution(None, self.dist, not self.no_deps)
+        # Install test requirements when developing.
+        if self.with_test_requirements and self.distribution.tests_require:
+            for tests_req in self.distribution.tests_require:
+                self.easy_install(tests_req)
 
 
     def uninstall_link(self):

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to