Skip to content

Commit 9c6eeed

Browse files
committed
add async test
(cherry picked from commit ebf65519f12d160da6d2088c22f6c69fad5a37d0)
1 parent a23518b commit 9c6eeed

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

test/test_client_backpressure.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright 2025-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
from __future__ import annotations
15+
16+
import os
17+
import sys
18+
19+
sys.path[0:0] = [""]
20+
21+
from test import (
22+
IntegrationTest,
23+
client_context,
24+
unittest,
25+
)
26+
from test.unified_format import generate_test_classes
27+
from test.utils_shared import EventListener, OvertCommandListener
28+
29+
_IS_SYNC = True
30+
31+
32+
class TestClientBackpressure(IntegrationTest):
33+
listener: EventListener
34+
35+
@classmethod
36+
def setUpClass(cls) -> None:
37+
cls.listener = OvertCommandListener()
38+
39+
@client_context.require_connection
40+
def setUp(self) -> None:
41+
super().setUp()
42+
self.listener.reset()
43+
self.client = self.rs_or_single_client(event_listeners=[self.listener], retryWrites=False)
44+
45+
46+
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "client-backpressure")
47+
48+
49+
globals().update(
50+
generate_test_classes(
51+
_TEST_PATH,
52+
module=__name__,
53+
)
54+
)
55+
56+
if __name__ == "__main__":
57+
unittest.main()

0 commit comments

Comments
 (0)