~jelmer/tarmac/breezy

« back to all changes in this revision

Viewing changes to tarmac/tests/test_log.py

  • Committer: Jelmer Vernooij
  • Date: 2022-09-08 13:38:53 UTC
  • Revision ID: jelmer@jelmer.uk-20220908133853-1ap6okwik10bd8y9
port to python 3

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
'''Tests for tarmac.log'''
19
 
import cStringIO
 
19
from io import StringIO
20
20
import os
21
21
import sys
22
22
 
40
40
        self.assertTrue(os.path.isdir('foo'))
41
41
 
42
42
    def test_ensure_log_dir_cannot_create(self):
43
 
        stderr = cStringIO.StringIO()
 
43
        stderr = StringIO()
44
44
        self.patch(sys, 'stderr', stderr)
45
45
        os.mkdir('foo')
46
 
        os.chmod('foo', 0500)
 
46
        os.chmod('foo', 0o500)
47
47
        log_file = 'foo/baz/bar.log'
48
48
        log.ensure_log_dir(log_file)
49
49
        self.assertFalse(os.path.exists('foo/baz'))
50
 
        os.chmod('foo', 0700)
 
50
        os.chmod('foo', 0o700)
51
51
        self.assertContainsRe(stderr.getvalue(),
52
52
            'Failed to create logging directory: .*foo/baz')
53
53