Skip to content

Commit b436647

Browse files
committed
PYTHON-5505 cleanup tests
1 parent eb113f0 commit b436647

File tree

2 files changed

+58
-58
lines changed

2 files changed

+58
-58
lines changed

test/asynchronous/test_backpressure.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ async def test_retry_overload_error_command(self):
4646
await self.db.t.insert_one({"x": 1})
4747

4848
# Ensure command is retried on overload error.
49-
fail_once = mock_overload_error.copy()
50-
fail_once["mode"] = {"times": _MAX_RETRIES}
51-
async with self.fail_point(fail_once):
49+
fail_many = mock_overload_error.copy()
50+
fail_many["mode"] = {"times": _MAX_RETRIES}
51+
async with self.fail_point(fail_many):
5252
await self.db.command("find", "t")
5353

5454
# Ensure command stops retrying after _MAX_RETRIES.
55-
fail_many_times = mock_overload_error.copy()
56-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
57-
async with self.fail_point(fail_many_times):
55+
fail_too_many = mock_overload_error.copy()
56+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
57+
async with self.fail_point(fail_too_many):
5858
with self.assertRaises(PyMongoError) as error:
5959
await self.db.command("find", "t")
6060

@@ -65,15 +65,15 @@ async def test_retry_overload_error_find(self):
6565
await self.db.t.insert_one({"x": 1})
6666

6767
# Ensure command is retried on overload error.
68-
fail_once = mock_overload_error.copy()
69-
fail_once["mode"] = {"times": _MAX_RETRIES}
70-
async with self.fail_point(fail_once):
68+
fail_many = mock_overload_error.copy()
69+
fail_many["mode"] = {"times": _MAX_RETRIES}
70+
async with self.fail_point(fail_many):
7171
await self.db.t.find_one()
7272

7373
# Ensure command stops retrying after _MAX_RETRIES.
74-
fail_many_times = mock_overload_error.copy()
75-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
76-
async with self.fail_point(fail_many_times):
74+
fail_too_many = mock_overload_error.copy()
75+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
76+
async with self.fail_point(fail_too_many):
7777
with self.assertRaises(PyMongoError) as error:
7878
await self.db.t.find_one()
7979

@@ -84,15 +84,15 @@ async def test_retry_overload_error_insert_one(self):
8484
await self.db.t.insert_one({"x": 1})
8585

8686
# Ensure command is retried on overload error.
87-
fail_once = mock_overload_error.copy()
88-
fail_once["mode"] = {"times": _MAX_RETRIES}
89-
async with self.fail_point(fail_once):
87+
fail_many = mock_overload_error.copy()
88+
fail_many["mode"] = {"times": _MAX_RETRIES}
89+
async with self.fail_point(fail_many):
9090
await self.db.t.find_one()
9191

9292
# Ensure command stops retrying after _MAX_RETRIES.
93-
fail_many_times = mock_overload_error.copy()
94-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
95-
async with self.fail_point(fail_many_times):
93+
fail_too_many = mock_overload_error.copy()
94+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
95+
async with self.fail_point(fail_too_many):
9696
with self.assertRaises(PyMongoError) as error:
9797
await self.db.t.find_one()
9898

@@ -105,15 +105,15 @@ async def test_retry_overload_error_update_many(self):
105105
await self.db.t.insert_one({"x": 1})
106106

107107
# Ensure command is retried on overload error.
108-
fail_once = mock_overload_error.copy()
109-
fail_once["mode"] = {"times": _MAX_RETRIES}
110-
async with self.fail_point(fail_once):
108+
fail_many = mock_overload_error.copy()
109+
fail_many["mode"] = {"times": _MAX_RETRIES}
110+
async with self.fail_point(fail_many):
111111
await self.db.t.update_many({}, {"$set": {"x": 2}})
112112

113113
# Ensure command stops retrying after _MAX_RETRIES.
114-
fail_many_times = mock_overload_error.copy()
115-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
116-
async with self.fail_point(fail_many_times):
114+
fail_too_many = mock_overload_error.copy()
115+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
116+
async with self.fail_point(fail_too_many):
117117
with self.assertRaises(PyMongoError) as error:
118118
await self.db.t.update_many({}, {"$set": {"x": 2}})
119119

@@ -125,7 +125,7 @@ async def test_retry_overload_error_getMore(self):
125125
await coll.insert_many([{"x": 1} for _ in range(10)])
126126

127127
# Ensure command is retried on overload error.
128-
fail_once = {
128+
fail_many = {
129129
"configureFailPoint": "failCommand",
130130
"mode": {"times": _MAX_RETRIES},
131131
"data": {
@@ -136,15 +136,15 @@ async def test_retry_overload_error_getMore(self):
136136
}
137137
cursor = coll.find(batch_size=2)
138138
await cursor.next()
139-
async with self.fail_point(fail_once):
139+
async with self.fail_point(fail_many):
140140
await cursor.to_list()
141141

142142
# Ensure command stops retrying after _MAX_RETRIES.
143-
fail_many_times = fail_once.copy()
144-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
143+
fail_too_many = fail_many.copy()
144+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
145145
cursor = coll.find(batch_size=2)
146146
await cursor.next()
147-
async with self.fail_point(fail_many_times):
147+
async with self.fail_point(fail_too_many):
148148
with self.assertRaises(PyMongoError) as error:
149149
await cursor.to_list()
150150

test/test_backpressure.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def test_retry_overload_error_command(self):
4646
self.db.t.insert_one({"x": 1})
4747

4848
# Ensure command is retried on overload error.
49-
fail_once = mock_overload_error.copy()
50-
fail_once["mode"] = {"times": _MAX_RETRIES}
51-
with self.fail_point(fail_once):
49+
fail_many = mock_overload_error.copy()
50+
fail_many["mode"] = {"times": _MAX_RETRIES}
51+
with self.fail_point(fail_many):
5252
self.db.command("find", "t")
5353

5454
# Ensure command stops retrying after _MAX_RETRIES.
55-
fail_many_times = mock_overload_error.copy()
56-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
57-
with self.fail_point(fail_many_times):
55+
fail_too_many = mock_overload_error.copy()
56+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
57+
with self.fail_point(fail_too_many):
5858
with self.assertRaises(PyMongoError) as error:
5959
self.db.command("find", "t")
6060

@@ -65,15 +65,15 @@ def test_retry_overload_error_find(self):
6565
self.db.t.insert_one({"x": 1})
6666

6767
# Ensure command is retried on overload error.
68-
fail_once = mock_overload_error.copy()
69-
fail_once["mode"] = {"times": _MAX_RETRIES}
70-
with self.fail_point(fail_once):
68+
fail_many = mock_overload_error.copy()
69+
fail_many["mode"] = {"times": _MAX_RETRIES}
70+
with self.fail_point(fail_many):
7171
self.db.t.find_one()
7272

7373
# Ensure command stops retrying after _MAX_RETRIES.
74-
fail_many_times = mock_overload_error.copy()
75-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
76-
with self.fail_point(fail_many_times):
74+
fail_too_many = mock_overload_error.copy()
75+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
76+
with self.fail_point(fail_too_many):
7777
with self.assertRaises(PyMongoError) as error:
7878
self.db.t.find_one()
7979

@@ -84,15 +84,15 @@ def test_retry_overload_error_insert_one(self):
8484
self.db.t.insert_one({"x": 1})
8585

8686
# Ensure command is retried on overload error.
87-
fail_once = mock_overload_error.copy()
88-
fail_once["mode"] = {"times": _MAX_RETRIES}
89-
with self.fail_point(fail_once):
87+
fail_many = mock_overload_error.copy()
88+
fail_many["mode"] = {"times": _MAX_RETRIES}
89+
with self.fail_point(fail_many):
9090
self.db.t.find_one()
9191

9292
# Ensure command stops retrying after _MAX_RETRIES.
93-
fail_many_times = mock_overload_error.copy()
94-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
95-
with self.fail_point(fail_many_times):
93+
fail_too_many = mock_overload_error.copy()
94+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
95+
with self.fail_point(fail_too_many):
9696
with self.assertRaises(PyMongoError) as error:
9797
self.db.t.find_one()
9898

@@ -105,15 +105,15 @@ def test_retry_overload_error_update_many(self):
105105
self.db.t.insert_one({"x": 1})
106106

107107
# Ensure command is retried on overload error.
108-
fail_once = mock_overload_error.copy()
109-
fail_once["mode"] = {"times": _MAX_RETRIES}
110-
with self.fail_point(fail_once):
108+
fail_many = mock_overload_error.copy()
109+
fail_many["mode"] = {"times": _MAX_RETRIES}
110+
with self.fail_point(fail_many):
111111
self.db.t.update_many({}, {"$set": {"x": 2}})
112112

113113
# Ensure command stops retrying after _MAX_RETRIES.
114-
fail_many_times = mock_overload_error.copy()
115-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
116-
with self.fail_point(fail_many_times):
114+
fail_too_many = mock_overload_error.copy()
115+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
116+
with self.fail_point(fail_too_many):
117117
with self.assertRaises(PyMongoError) as error:
118118
self.db.t.update_many({}, {"$set": {"x": 2}})
119119

@@ -125,7 +125,7 @@ def test_retry_overload_error_getMore(self):
125125
coll.insert_many([{"x": 1} for _ in range(10)])
126126

127127
# Ensure command is retried on overload error.
128-
fail_once = {
128+
fail_many = {
129129
"configureFailPoint": "failCommand",
130130
"mode": {"times": _MAX_RETRIES},
131131
"data": {
@@ -136,15 +136,15 @@ def test_retry_overload_error_getMore(self):
136136
}
137137
cursor = coll.find(batch_size=2)
138138
cursor.next()
139-
with self.fail_point(fail_once):
139+
with self.fail_point(fail_many):
140140
cursor.to_list()
141141

142142
# Ensure command stops retrying after _MAX_RETRIES.
143-
fail_many_times = fail_once.copy()
144-
fail_many_times["mode"] = {"times": _MAX_RETRIES + 1}
143+
fail_too_many = fail_many.copy()
144+
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
145145
cursor = coll.find(batch_size=2)
146146
cursor.next()
147-
with self.fail_point(fail_many_times):
147+
with self.fail_point(fail_too_many):
148148
with self.assertRaises(PyMongoError) as error:
149149
cursor.to_list()
150150

0 commit comments

Comments
 (0)