Exemple #1
0
 def test_exception_from_error_queue_nonexistent_reason(self):
     """
     :func:`exception_from_error_queue` raises ``ValueError`` when it
     encounters an OpenSSL error code which does not have a reason string.
     """
     lib.ERR_put_error(lib.ERR_LIB_EVP, 0, 1112, b"", 10)
     with pytest.raises(ValueError) as exc:
         exception_from_error_queue(ValueError)
     assert exc.value.args[0][0][2] == ""
Exemple #2
0
    def tearDown(self):
        """
        Clean up any files or directories created using
        :py:meth:`TestCase.mktemp`.  Subclasses must invoke this method if they
        override it or the cleanup will not occur.
        """
        if self._tmpdir is not None:
            shutil.rmtree(self._tmpdir)

        try:
            exception_from_error_queue(Error)
        except Error:
            e = sys.exc_info()[1]
            if e.args != ([], ):
                self.fail("Left over errors in OpenSSL error queue: " +
                          repr(e))
Exemple #3
0
    def tearDown(self):
        """
        Clean up any files or directories created using
        :py:meth:`TestCase.mktemp`.  Subclasses must invoke this method if they
        override it or the cleanup will not occur.
        """
        if self._tmpdir is not None:
            shutil.rmtree(self._tmpdir)

        try:
            exception_from_error_queue(Error)
        except Error:
            e = sys.exc_info()[1]
            if e.args != ([],):
                self.fail(
                    "Left over errors in OpenSSL error queue: " + repr(e)
                )
Exemple #4
0
 def tearDown(self):
     """
     Clean up any files or directories created using :py:meth:`TestCase.mktemp`.
     Subclasses must invoke this method if they override it or the
     cleanup will not occur.
     """
     if False and self._temporaryFiles is not None:
         for temp in self._temporaryFiles:
             if os.path.isdir(temp):
                 shutil.rmtree(temp)
             elif os.path.exists(temp):
                 os.unlink(temp)
     try:
         exception_from_error_queue(Error)
     except Error:
         e = sys.exc_info()[1]
         if e.args != ([],):
             self.fail("Left over errors in OpenSSL error queue: " + repr(e))
Exemple #5
0
 def tearDown(self):
     """
     Clean up any files or directories created using :py:meth:`TestCase.mktemp`.
     Subclasses must invoke this method if they override it or the
     cleanup will not occur.
     """
     if False and self._temporaryFiles is not None:
         for temp in self._temporaryFiles:
             if os.path.isdir(temp):
                 shutil.rmtree(temp)
             elif os.path.exists(temp):
                 os.unlink(temp)
     try:
         exception_from_error_queue(Error)
     except Error:
         e = sys.exc_info()[1]
         if e.args != ([], ):
             self.fail("Left over errors in OpenSSL error queue: " +
                       repr(e))