예제 #1
0
파일: test_ffs.py 프로젝트: davidmiller/ffs
    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
파일: test_ffs.py 프로젝트: davidmiller/ffs
    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
파일: test_ffs.py 프로젝트: davidmiller/ffs
 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')