##// END OF EJS Templates
regexp group in BatchLauncher, no Condor -verbose...
regexp group in BatchLauncher, no Condor -verbose Previously I used condor_submit -verbose so that I could pull the job id from the first line. However, when submitting many jobs it's silly to have to search through some many lines of output. Now we have a regexp for Condor that matches on the non-verbose output. Here the job_id is on the end of the output, so using grouping in our job_id_regexp becomes very useful. To account for this I have added a job_id_regexp_group property to the BatchLauncher and it's subclasses. The default of 0 means the whole regexp is matched - however now an integer can be passed in here to instead select a subgroup of the expression (see CondorLauncher and the mechanism will be clear).

File last commit:

r5529:a1b74bc4
r10991:ee0bd57f
Show More
nosepatch.py
76 lines | 2.8 KiB | text/x-python | PythonLexer
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367 """Monkeypatch nose to accept any callable as a method.
By default, nose's ismethod() fails for static methods.
Once this is fixed in upstream nose we can disable it.
Fernando Perez
Small cleanups and documentation to testing support code....
r5529 Notes:
- As of Nose 1.0.0, the problem persists so this monkeypatch is still
needed.
- Merely importing this module causes the monkeypatch to be applied."""
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367
Brian Granger
Work to address the review comments on Fernando's branch....
r2498 #-----------------------------------------------------------------------------
Matthias BUSSONNIER
update copyright to 2011/20xx-2011...
r5390 # Copyright (C) 2009-2011 The IPython Development Team
Brian Granger
Work to address the review comments on Fernando's branch....
r2498 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367 import unittest
Thomas Kluyver
Don't monkeypatch nose in Python 3, as it must be a newer version.
r4761 import sys
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367 import nose.loader
from inspect import ismethod, isfunction
Brian Granger
Work to address the review comments on Fernando's branch....
r2498 #-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367 def getTestCaseNames(self, testCaseClass):
"""Override to select with selector, unless
config.getTestCaseNamesCompat is True
"""
if self.config.getTestCaseNamesCompat:
return unittest.TestLoader.getTestCaseNames(self, testCaseClass)
def wanted(attr, cls=testCaseClass, sel=self.selector):
item = getattr(cls, attr, None)
# MONKEYPATCH: replace this:
#if not ismethod(item):
# return False
# return sel.wantMethod(item)
# With:
if ismethod(item):
return sel.wantMethod(item)
# static method or something. If this is a static method, we
# can't get the class information, and we have to treat it
# as a function. Thus, we will miss things like class
# attributes for test selection
if isfunction(item):
return sel.wantFunction(item)
return False
# END MONKEYPATCH
cases = filter(wanted, dir(testCaseClass))
for base in testCaseClass.__bases__:
for case in self.getTestCaseNames(base):
if case not in cases:
cases.append(case)
# add runTest if nothing else picked
if not cases and hasattr(testCaseClass, 'runTest'):
cases = ['runTest']
if self.sortTestMethodsUsing:
cases.sort(self.sortTestMethodsUsing)
return cases
##########################################################################
# Apply monkeypatch here
Thomas Kluyver
Don't monkeypatch nose in Python 3, as it must be a newer version.
r4761 # Python 3 must be running with newer version of Nose, so don't touch anything.
if sys.version_info[0] < 3:
nose.loader.TestLoader.getTestCaseNames = getTestCaseNames
Fernando Perez
Added test support for better parametric tests and nose fixes....
r2367 ##########################################################################