Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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')