/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_lockdir.py

Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    LockDir,
41
41
    LockHeldInfo,
42
42
    )
 
43
from ..sixish import (
 
44
    text_type,
 
45
    )
43
46
from . import (
44
47
    features,
45
48
    TestCase,
346
349
        ld2 = self.get_lock()
347
350
        ld.create()
348
351
        ld.lock_write()
349
 
        ld.transport.put_bytes_non_atomic('test_lock/held/info', '\0')
 
352
        ld.transport.put_bytes_non_atomic('test_lock/held/info', b'\0')
350
353
 
351
354
        class LoggingUIFactory(breezy.ui.SilentUIFactory):
352
355
            def __init__(self):
508
511
        t = self.get_transport()
509
512
        t.mkdir('test_lock')
510
513
        t.mkdir('test_lock/held')
511
 
        t.put_bytes('test_lock/held/info', '')
 
514
        t.put_bytes('test_lock/held/info', b'')
512
515
        lf = LockDir(t, 'test_lock')
513
516
        info = lf.peek()
514
517
        formatted_info = info.to_readable_dict()
526
529
        t = self.get_transport()
527
530
        t.mkdir('test_lock')
528
531
        t.mkdir('test_lock/held')
529
 
        t.put_bytes('test_lock/held/info', '\0')
 
532
        t.put_bytes('test_lock/held/info', b'\0')
530
533
        lf = LockDir(t, 'test_lock')
531
534
        self.assertRaises(errors.LockCorrupt, lf.peek)
532
535
        # Currently attempt_lock gives LockContention, but LockCorrupt would be
665
668
 
666
669
    def test_unicode(self):
667
670
        info = LockHeldInfo.for_this_process(None)
668
 
        self.assertContainsRe(unicode(info),
 
671
        self.assertContainsRe(text_type(info),
669
672
            r'held by .* on .* \(process #\d+\), acquired .* ago')
670
673
 
671
674
    def test_is_locked_by_this_process(self):