Repository: DataBiosphere/toil

Issue:
Toil restart entry point is named wrong
Should be toilRestart, not toilRestarts



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,17 @@
-from setuptools import setup, find_packages
+import sys
 
-setup(
+from setuptools import find_packages, setup
+
+kwargs = dict(
     name='toil',
     version='3.0.6a1',
     description='Pipeline management software for clusters.',
     author='Benedict Paten',
     author_email='benedict@soe.usc.edu',
     url="https://github.com/BD2KGenomics/toil",
-    install_requires=[ 'bd2k-python-lib>=1.7.dev1' ],
-    tests_require=[ 'mock==1.0.1' ],
-    test_suite = 'toil',
+    install_requires=[ 'bd2k-python-lib==1.7.dev1' ],
+    tests_require=[ 'mock==1.0.1', 'pytest==2.7.2' ],
+    test_suite='toil',
     extras_require={
         'mesos': [
             'mesos.interface==0.22.0',
@@ -23,6 +25,31 @@
             'toilKill = toil.utils.toilKill:main',
             'toilStatus = toil.utils.toilStatus:main',
             'toilStats = toil.utils.toilStats:main',
-            'toilRestarts = toil.utils.toilRestarts:main',
+            'toilRestart = toil.utils.toilRestart:main',
             'multijob = toil.batchSystems.multijob:main',
             'toil-mesos-executor = toil.batchSystems.mesos.executor:main [mesos]' ] } )
+
+from setuptools.command.test import test as TestCommand
+
+
+class PyTest( TestCommand ):
+    user_options = [ ('pytest-args=', 'a', "Arguments to pass to py.test") ]
+
+    def initialize_options( self ):
+        TestCommand.initialize_options( self )
+        self.pytest_args = [ ]
+
+    def finalize_options( self ):
+        TestCommand.finalize_options( self )
+        self.test_args = [ ]
+        self.test_suite = True
+
+    def run_tests( self ):
+        import pytest
+        errno = pytest.main( self.pytest_args )
+        sys.exit( errno )
+
+
+kwargs[ 'cmdclass' ] = { 'test': PyTest }
+
+setup( **kwargs )
diff --git a/src/toil/resource.py b/src/toil/resource.py
--- a/src/toil/resource.py
+++ b/src/toil/resource.py
@@ -264,12 +264,17 @@ class ModuleDescriptor( namedtuple( 'ModuleDescriptor', ('dirPath', 'name', 'ext
     - extension, the file extension of the file containing the module, including the leading period.
 
     >>> import toil.resource
-    >>> ModuleDescriptor.forModule(toil.resource.__name__) # doctest: +ELLIPSIS
-    ModuleDescriptor(dirPath='/.../src', name='toil.resource', extension='.pyc')
+    >>> ModuleDescriptor.forModule('toil.resource') # doctest: +ELLIPSIS
+    ModuleDescriptor(dirPath='/.../src', name='toil.resource', extension='.py')
+
+    Note that the above test only succeeds on py.test. To run with doctest or an IDE you may have
+    to change the assertion to .pyc.
+
     >>> import subprocess, tempfile, os
     >>> fh,path = tempfile.mkstemp(prefix='foo', suffix='.py')
     >>> with os.fdopen(fh,'w') as f:
-    ...     f.write('from toil.resource import ModuleDescriptor; print ModuleDescriptor.forModule(__name__)')
+    ...     f.write('from toil.resource import ModuleDescriptor\\n'
+    ...             'print ModuleDescriptor.forModule(__name__)')
     >>> subprocess.check_output([ 'python', path ]) # doctest: +ELLIPSIS
     "ModuleDescriptor(dirPath='/...', name='foo...', extension='.py')\\n"
     """


Test patch: