Skip to content

Commit

Permalink
Re-use run context.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 24, 2024
1 parent f14608e commit 691819b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions jaraco/mongodb/tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,19 @@
@pytest.mark.xfail(reason="#31")
def test_MongoDBReplicaSet_writable():
rs = service.MongoDBReplicaSet()
rs.start()
try:
with rs.run():
conn = pymongo.MongoClient(rs.get_connect_hosts())
conn.database.collection.insert_one({'foo': 'bar'})
finally:
rs.stop()


def test_MongoDBReplicaSet_starts_quickly():
pytest.skip("Takes 20-30 seconds")
sw = timing.Stopwatch()
rs = service.MongoDBReplicaSet()
rs.start()
try:
with rs.run():
elapsed = sw.split()
limit = datetime.timedelta(seconds=5)
assert elapsed < limit
finally:
rs.stop()


def test_fixture(mongodb_instance):
Expand Down

0 comments on commit 691819b

Please sign in to comment.