~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/TestUtil.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
#
18
18
 
19
19
import sys
47
47
def visitTests(suite, visitor):
48
48
    """A foreign method for visiting the tests in a test suite."""
49
49
    for test in suite._tests:
50
 
        #Abusing types to avoid monkey patching unittest.TestCase. 
 
50
        #Abusing types to avoid monkey patching unittest.TestCase.
51
51
        # Maybe that would be better?
52
52
        try:
53
53
            test.visit(visitor)
59
59
                visitTests(test, visitor)
60
60
            else:
61
61
                print "unvisitable non-unittest.TestCase element %r (%r)" % (test, test.__class__)
62
 
    
 
62
 
63
63
 
64
64
class TestSuite(unittest.TestSuite):
65
65
    """I am an extended TestSuite with a visitor interface.
83
83
    def loadTestsFromModuleNames(self, names):
84
84
        """use a custom means to load tests from modules.
85
85
 
86
 
        There is an undesirable glitch in the python TestLoader where a 
87
 
        import error is ignore. We think this can be solved by ensuring the 
 
86
        There is an undesirable glitch in the python TestLoader where a
 
87
        import error is ignore. We think this can be solved by ensuring the
88
88
        requested name is resolvable, if its not raising the original error.
89
89
        """
90
90
        result = self.suiteClass()
107
107
        regular python loadTestsFromModule.
108
108
 
109
109
        If a load_tests attribute is found, it is called and the result is
110
 
        returned. 
 
110
        returned.
111
111
 
112
112
        load_tests should be defined like so:
113
113
        >>> def load_tests(standard_tests, module, loader):