Exemple #1
0
    def test_unlink_already_gone(self):
        os_unlink_calls = []

        def _os_unlink(*args):
            os_unlink_calls.append(args)
            err = OSError('testing')
            err.errno = util.ENOENT
            raise err

        util.os_unlink = _os_unlink
        util.unlink('test')
        self.assertEqual(os_unlink_calls, [('test',)])
Exemple #2
0
    def test_unlink_other_error(self):
        os_unlink_calls = []

        def _os_unlink(*args):
            os_unlink_calls.append(args)
            raise OSError('testing')

        util.os_unlink = _os_unlink
        exc = None
        try:
            util.unlink('test')
        except Exception, err:
            exc = err
Exemple #3
0
    def test_unlink_other_error(self):
        os_unlink_calls = []

        def _os_unlink(*args):
            os_unlink_calls.append(args)
            raise OSError('testing')

        util.os_unlink = _os_unlink
        exc = None
        try:
            util.unlink('test')
        except Exception as err:
            exc = err
        self.assertEqual(str(exc), 'testing')
        self.assertEqual(os_unlink_calls, [('test',)])
Exemple #4
0
 def test_unlink(self):
     util.unlink('test')
     self.assertEqual(self.os_unlink_calls, [('test',)])