~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockdir.py

  • Committer: Vincent Ladeuil
  • Date: 2010-03-02 10:21:39 UTC
  • mfrom: (4797.2.24 2.1)
  • mto: This revision was merged to the branch mainline in revision 5069.
  • Revision ID: v.ladeuil+lp@free.fr-20100302102139-b5cba7h6xu13mekg
Merge 2.1 into trunk including fixes for #331095, #507557, #185103, #524184 and #369501

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
666
666
        # no kibble
667
667
        check_dir(['held'])
668
668
 
 
669
    def test_no_lockdir_info(self):
 
670
        """We can cope with empty info files."""
 
671
        # This seems like a fairly common failure case - see
 
672
        # <https://bugs.edge.launchpad.net/bzr/+bug/185103> and all its dupes.
 
673
        # Processes are often interrupted after opening the file
 
674
        # before the actual contents are committed.
 
675
        t = self.get_transport()
 
676
        t.mkdir('test_lock')
 
677
        t.mkdir('test_lock/held')
 
678
        t.put_bytes('test_lock/held/info', '')
 
679
        lf = LockDir(t, 'test_lock')
 
680
        info = lf.peek()
 
681
        formatted_info = lf._format_lock_info(info)
 
682
        self.assertEquals(
 
683
            ['lock %s' % t.abspath('test_lock'),
 
684
             'held by <unknown> on host <unknown> [process #<unknown>]',
 
685
             'locked (unknown)'],
 
686
            formatted_info)
 
687
 
669
688
 
670
689
class TestLockDirHooks(TestCaseWithTransport):
671
690