~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-17 06:04:47 UTC
  • mfrom: (3119.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20071217060447-sictlq5nibqhpuec
Move material out of User Guide into User Reference (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1071
1071
        self.build_tree_contents([('foo', text)])
1072
1072
        expected_sha = osutils.sha_string(text)
1073
1073
        self.assertEqual(expected_sha, osutils.sha_file_by_name('foo'))
 
1074
 
 
1075
 
 
1076
_debug_text = \
 
1077
r'''# Copyright (C) 2005, 2006 Canonical Ltd
 
1078
#
 
1079
# This program is free software; you can redistribute it and/or modify
 
1080
# it under the terms of the GNU General Public License as published by
 
1081
# the Free Software Foundation; either version 2 of the License, or
 
1082
# (at your option) any later version.
 
1083
#
 
1084
# This program is distributed in the hope that it will be useful,
 
1085
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1086
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1087
# GNU General Public License for more details.
 
1088
#
 
1089
# You should have received a copy of the GNU General Public License
 
1090
# along with this program; if not, write to the Free Software
 
1091
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
1092
 
 
1093
 
 
1094
# NOTE: If update these, please also update the help for global-options in
 
1095
#       bzrlib/help_topics.py.
 
1096
 
 
1097
debug_flags = set()
 
1098
"""Set of flags that enable different debug behaviour.
 
1099
 
 
1100
These are set with eg ``-Dlock`` on the bzr command line.
 
1101
 
 
1102
Options include:
 
1103
 
 
1104
 * auth - show authentication sections used
 
1105
 * error - show stack traces for all top level exceptions
 
1106
 * evil - capture call sites that do expensive or badly-scaling operations.
 
1107
 * fetch - trace history copying between repositories
 
1108
 * hooks - trace hook execution
 
1109
 * hpss - trace smart protocol requests and responses
 
1110
 * http - trace http connections, requests and responses
 
1111
 * index - trace major index operations
 
1112
 * lock - trace when lockdir locks are taken or released
 
1113
 * merge - emit information for debugging merges
 
1114
 
 
1115
"""
 
1116
'''
 
1117
 
 
1118
 
 
1119
class TestResourceLoading(TestCaseInTempDir):
 
1120
 
 
1121
    def test_resource_string(self):
 
1122
        # test resource in bzrlib
 
1123
        text = osutils.resource_string('bzrlib', 'debug.py')
 
1124
        self.assertEquals(_debug_text, text)
 
1125
        # test resource under bzrlib
 
1126
        text = osutils.resource_string('bzrlib.ui', 'text.py')
 
1127
        self.assertContainsRe(text, "class TextUIFactory")
 
1128
        # test unsupported package
 
1129
        self.assertRaises(errors.BzrError, osutils.resource_string, 'zzzz',
 
1130
            'yyy.xx')
 
1131
        # test unknown resource
 
1132
        self.assertRaises(IOError, osutils.resource_string, 'bzrlib', 'yyy.xx')