示例#1
0
    def test_err(self):
        "Should pass up the err"
        def raiser(*args, **kwargs):
            raise ValueError()

        with patch.object(ffs.os, 'makedirs') as pmkd:
            pmkd.side_effect = raiser
            with self.assertRaises(ValueError):
                ffs.mkdir_p('/ihd/lost/pairing')
                pmkd.assert_called_once_with('/ihd/lost/pairing')
示例#2
0
    def test_err(self):
        "Should pass up the err"

        def raiser(*args, **kwargs):
            raise ValueError()

        with patch.object(ffs.os, 'makedirs') as pmkd:
            pmkd.side_effect = raiser
            with self.assertRaises(ValueError):
                ffs.mkdir_p('/ihd/lost/pairing')
                pmkd.assert_called_once_with('/ihd/lost/pairing')
示例#3
0
    def test_EEXIST(self):
        "Already exists"
        def raiser(*args, **kwargs):
            err = OSError()
            err.errno = errno.EEXIST
            raise err

        with patch.object(ffs.os, 'makedirs') as pmkd:
            pmkd.side_effect = raiser
            ffs.mkdir_p('/ihd/lost/pairing')
            pmkd.assert_called_once_with('/ihd/lost/pairing')
示例#4
0
    def test_EEXIST(self):
        "Already exists"

        def raiser(*args, **kwargs):
            err = OSError()
            err.errno = errno.EEXIST
            raise err

        with patch.object(ffs.os, 'makedirs') as pmkd:
            pmkd.side_effect = raiser
            ffs.mkdir_p('/ihd/lost/pairing')
            pmkd.assert_called_once_with('/ihd/lost/pairing')
示例#5
0
 def test_mkdirs(self):
     "Simple case"
     with patch.object(ffs.os, 'makedirs') as pmkd:
         ffs.mkdir_p('/ihd/lost/pairing')
         pmkd.assert_called_once_with('/ihd/lost/pairing')
示例#6
0
 def test_mkdirs(self):
     "Simple case"
     with patch.object(ffs.os, 'makedirs') as pmkd:
         ffs.mkdir_p('/ihd/lost/pairing')
         pmkd.assert_called_once_with('/ihd/lost/pairing')