mongo-python-driver/test/test_errors.py
Mike Dirolf c8e64f4c02 Use PyMongoError instead of BaseMongoDBException
Note that this is changing the exception hierarchy somewhat as well,
as I would rather not muck things up with multiple inheritance. This
is a breaking change if you depend on ConnectionFailure being an
IOError or InvalidBSON being a ValueError, for example. If this
creates issues for anybody please let us know and we can figure out a
better workaround.

Also add Michael to contributors list.
2010-01-12 16:47:50 -05:00

33 lines
907 B
Python

# Copyright 2009 10gen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test the errors module."""
import unittest
import sys
sys.path[0:0] = [""]
from pymongo import Connection
from pymongo.errors import PyMongoError
class TestErrors(unittest.TestCase):
def test_base_exception(self):
self.assertRaises(PyMongoError, Connection, port=0)
if __name__ == '__main__':
unittest.main()