Ejemplo n.º 1
0
    def test3_file_create(self):
        'QueueBase._file_create()'
        # File in non existent directory should produce ENOENT.
        fn = os.getcwd() + "/nodir/nofile"
        try:
            QueueBase._file_create(fn, 0, False)
        except OSError:
            error = sys.exc_info()[1]
            assert error.errno == errno.ENOENT

        QueueBase._file_create(self.tempfile, 0, False)
        self.failUnlessRaises(OSError, QueueBase._file_create,
                              *(self.tempfile, 0, False))
        os.unlink(self.tempfile)
        # utf8 data
        QueueBase._file_create(self.tempfile, 0, True)
        self.failUnlessRaises(OSError, QueueBase._file_create,
                              *(self.tempfile, 0, True))
Ejemplo n.º 2
0
    def test3_file_create(self):
        'QueueBase._file_create()'
        # File in non existent directory should produce ENOENT.
        fn = os.getcwd() + "/nodir/nofile"
        try:
            QueueBase._file_create(fn, 0, False)
        except OSError:
            error = sys.exc_info()[1]
            assert error.errno == errno.ENOENT

        QueueBase._file_create(self.tempfile, 0, False)
        self.failUnlessRaises(OSError,
                              QueueBase._file_create,
                              *(self.tempfile, 0, False))
        os.unlink(self.tempfile)
        # utf8 data
        QueueBase._file_create(self.tempfile, 0, True)
        self.failUnlessRaises(OSError,
                              QueueBase._file_create,
                              *(self.tempfile, 0, True))