~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-23 08:51:52 UTC
  • mfrom: (5131.2.6 support_OO_flag)
  • mto: This revision was merged to the branch mainline in revision 5179.
  • Revision ID: v.ladeuil+lp@free.fr-20100423085152-uoewc1vnkwqhw0pj
Manually assign docstrings to command objects, so that they work with python -OO

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
"""Testing framework extensions"""
17
18
 
18
19
# TODO: Perhaps there should be an API to find out if bzr running under the
19
20
# test suite -- some plugins might want to avoid making intrusive changes if
1312
1313
            f.close()
1313
1314
        self.assertEqualDiff(content, s)
1314
1315
 
 
1316
    def assertDocstring(self, expected_docstring, obj):
 
1317
        """Fail if obj does not have expected_docstring"""
 
1318
        if __doc__ is None:
 
1319
            # With -OO the docstring should be None instead
 
1320
            self.assertIs(obj.__doc__, None)
 
1321
        else:
 
1322
            self.assertEqual(expected_docstring, obj.__doc__)
 
1323
 
1315
1324
    def failUnlessExists(self, path):
1316
1325
        """Fail unless path or paths, which may be abs or relative, exist."""
1317
1326
        if not isinstance(path, basestring):
3796
3805
 
3797
3806
 
3798
3807
def _test_suite_modules_to_doctest():
3799
 
    """Return the list of modules to doctest."""   
 
3808
    """Return the list of modules to doctest."""
 
3809
    if __doc__ is None:
 
3810
        # GZ 2009-03-31: No docstrings with -OO so there's nothing to doctest
 
3811
        return []
3800
3812
    return [
3801
3813
        'bzrlib',
3802
3814
        'bzrlib.branchbuilder',