Skip to content

Commit

Permalink
Update mongodb example to avoid loading the conftest.py of pip-run, u…
Browse files Browse the repository at this point in the history
…pdating to match expectation based on new jaraco.mongodb, and fixing syntax for updated pymongo.
  • Loading branch information
jaraco committed Sep 2, 2023
1 parent 5999904 commit cfefbb5
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions examples/test-mongodb-covered-query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
It creates a MongoDB instance, and then runs some
assertions against it.
As it uses `jaraco.mongodb
<https://pypi.org/project/jaraco.mongodb>`_, MongoDB
must be installed to a typical location or
available on PATH; set MONGODB_HOME to
specify the MongoDB version to use for the ephemeral
instance.
The script uses `jaraco.mongodb
<https://pypi.org/project/jaraco.mongodb>`_ to (maybe)
install and configure an ephemeral instance of MongoDB.
Running this script with ``pip-run``` leaves no trace of its
execution, other than adding packages to the pip
Expand Down Expand Up @@ -45,7 +42,7 @@
import pytest
import sys

sys.exit(pytest.main(sys.argv))
sys.exit(pytest.main(['--noconftest'] + sys.argv))

import random
import itertools
Expand All @@ -66,7 +63,7 @@ def docs_in_db(mongodb_instance):
n_records = 100
for n in itertools.islice(itertools.count(), n_records):
doc = dict(number=random.randint(0, 2**32 - 1), value='some value')
conn.test_db.test_coll.insert(doc)
conn.test_db.test_coll.insert_one(doc)
return coll


Expand Down

0 comments on commit cfefbb5

Please sign in to comment.