Skip to content

PYTHON-3131 Test Failure - test_mypy on macos + auth #875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions test/test_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
except ImportError:
api = None

from test import IntegrationTest

from bson.son import SON
from pymongo.collection import Collection
from pymongo.errors import ServerSelectionTimeoutError
from pymongo.mongo_client import MongoClient
from pymongo.operations import InsertOne

TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mypy_fails")
Expand All @@ -53,22 +53,13 @@ def test_mypy_failures(self) -> None:
self.ensure_mypy_fails(filename)


class TestPymongo(unittest.TestCase):
client: MongoClient
class TestPymongo(IntegrationTest):
coll: Collection

@classmethod
def setUpClass(cls) -> None:
cls.client = MongoClient(serverSelectionTimeoutMS=250, directConnection=False)
def setUpClass(cls):
super().setUpClass()
cls.coll = cls.client.test.test
try:
cls.client.admin.command("ping")
except ServerSelectionTimeoutError as exc:
raise unittest.SkipTest(f"Could not connect to MongoDB: {exc}")

@classmethod
def tearDownClass(cls) -> None:
cls.client.close()

def test_insert_find(self) -> None:
doc = {"my": "doc"}
Expand Down