~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/fixtures.py

  • Committer: Alexander Belchenko
  • Date: 2012-03-29 08:34:13 UTC
  • mto: (6015.44.14 2.4)
  • mto: This revision was merged to the branch mainline in revision 6513.
  • Revision ID: bialix@ukr.net-20120329083413-d4bqqdtfn2yrxp4f
change st_dev, st_ino, st_uid, st_gid from int members to properties.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
    source.set_last_revision_info(1, 'rev-1')
126
126
    return source
127
127
 
128
 
 
129
 
def make_branch_and_populated_tree(testcase):
130
 
    """Make a simple branch and tree.
131
 
 
132
 
    The tree holds some added but uncommitted files.
133
 
    """
134
 
    # TODO: Either accept or return the names of the files, so the caller
135
 
    # doesn't need to be bound to the particular files created? -- mbp
136
 
    # 20110705
137
 
    tree = testcase.make_branch_and_tree('t')
138
 
    testcase.build_tree_contents([('t/hello', 'hello world')])
139
 
    tree.add(['hello'], ['hello-id'])
140
 
    return tree
141
 
 
142
 
 
143
 
class TimeoutFixture(object):
144
 
    """Kill a test with sigalarm if it runs too long.
145
 
    
146
 
    Only works on Unix at present.
147
 
    """
148
 
 
149
 
    def __init__(self, timeout_secs):
150
 
        import signal
151
 
        self.timeout_secs = timeout_secs
152
 
        self.alarm_fn = getattr(signal, 'alarm', None)
153
 
 
154
 
    def setUp(self):
155
 
        if self.alarm_fn is not None:
156
 
            self.alarm_fn(self.timeout_secs)
157
 
 
158
 
    def cleanUp(self):
159
 
        if self.alarm_fn is not None:
160
 
            self.alarm_fn(0)