Skip to content

Commit d2595e2

Browse files
authored
Merge branch 'master' into PYTHON-4851
2 parents d09adc8 + 4eeaa4b commit d2595e2

9 files changed

+207
-5
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2023-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+
15+
"""Run the command monitoring unified format spec tests."""
16+
from __future__ import annotations
17+
18+
import os
19+
import pathlib
20+
import sys
21+
22+
sys.path[0:0] = [""]
23+
24+
from test import unittest
25+
from test.asynchronous.unified_format import generate_test_classes
26+
27+
_IS_SYNC = False
28+
29+
# Location of JSON test specifications.
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "command_logging")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "command_logging")
34+
35+
36+
globals().update(
37+
generate_test_classes(
38+
_TEST_PATH,
39+
module=__name__,
40+
)
41+
)
42+
43+
if __name__ == "__main__":
44+
unittest.main()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2015-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+
15+
"""Run the command monitoring unified format spec tests."""
16+
from __future__ import annotations
17+
18+
import os
19+
import pathlib
20+
import sys
21+
22+
sys.path[0:0] = [""]
23+
24+
from test import unittest
25+
from test.asynchronous.unified_format import generate_test_classes
26+
27+
_IS_SYNC = False
28+
29+
# Location of JSON test specifications.
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "command_monitoring")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "command_monitoring")
34+
35+
36+
globals().update(
37+
generate_test_classes(
38+
_TEST_PATH,
39+
module=__name__,
40+
)
41+
)
42+
43+
44+
if __name__ == "__main__":
45+
unittest.main()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2023-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+
15+
"""Run the connection logging unified format spec tests."""
16+
from __future__ import annotations
17+
18+
import os
19+
import pathlib
20+
import sys
21+
22+
sys.path[0:0] = [""]
23+
24+
from test import unittest
25+
from test.unified_format import generate_test_classes
26+
27+
_IS_SYNC = False
28+
29+
# Location of JSON test specifications.
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "connection_logging")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "connection_logging")
34+
35+
36+
globals().update(
37+
generate_test_classes(
38+
_TEST_PATH,
39+
module=__name__,
40+
)
41+
)
42+
43+
44+
if __name__ == "__main__":
45+
unittest.main()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2021-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+
15+
"""Test the CRUD unified spec tests."""
16+
from __future__ import annotations
17+
18+
import os
19+
import pathlib
20+
import sys
21+
22+
sys.path[0:0] = [""]
23+
24+
from test import unittest
25+
from test.unified_format import generate_test_classes
26+
27+
_IS_SYNC = False
28+
29+
# Location of JSON test specifications.
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "crud", "unified")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "crud", "unified")
34+
35+
# Generate unified tests.
36+
globals().update(generate_test_classes(_TEST_PATH, module=__name__, RUN_ON_SERVERLESS=True))
37+
38+
if __name__ == "__main__":
39+
unittest.main()

test/test_command_logging.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@
1616
from __future__ import annotations
1717

1818
import os
19+
import pathlib
1920
import sys
2021

2122
sys.path[0:0] = [""]
2223

2324
from test import unittest
2425
from test.unified_format import generate_test_classes
2526

27+
_IS_SYNC = True
28+
2629
# Location of JSON test specifications.
27-
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "command_logging")
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "command_logging")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "command_logging")
34+
2835

2936
globals().update(
3037
generate_test_classes(

test/test_command_monitoring.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616
from __future__ import annotations
1717

1818
import os
19+
import pathlib
1920
import sys
2021

2122
sys.path[0:0] = [""]
2223

2324
from test import unittest
2425
from test.unified_format import generate_test_classes
2526

27+
_IS_SYNC = True
28+
2629
# Location of JSON test specifications.
27-
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "command_monitoring")
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "command_monitoring")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "command_monitoring")
2834

2935

3036
globals().update(

test/test_connection_logging.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616
from __future__ import annotations
1717

1818
import os
19+
import pathlib
1920
import sys
2021

2122
sys.path[0:0] = [""]
2223

2324
from test import unittest
2425
from test.unified_format import generate_test_classes
2526

27+
_IS_SYNC = True
28+
2629
# Location of JSON test specifications.
27-
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "connection_logging")
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "connection_logging")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "connection_logging")
2834

2935

3036
globals().update(

test/test_crud_unified.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@
1616
from __future__ import annotations
1717

1818
import os
19+
import pathlib
1920
import sys
2021

2122
sys.path[0:0] = [""]
2223

2324
from test import unittest
2425
from test.unified_format import generate_test_classes
2526

27+
_IS_SYNC = True
28+
2629
# Location of JSON test specifications.
27-
TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "crud", "unified")
30+
if _IS_SYNC:
31+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent, "crud", "unified")
32+
else:
33+
_TEST_PATH = os.path.join(pathlib.Path(__file__).resolve().parent.parent, "crud", "unified")
2834

2935
# Generate unified tests.
30-
globals().update(generate_test_classes(TEST_PATH, module=__name__, RUN_ON_SERVERLESS=True))
36+
globals().update(generate_test_classes(_TEST_PATH, module=__name__, RUN_ON_SERVERLESS=True))
3137

3238
if __name__ == "__main__":
3339
unittest.main()

tools/synchro.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,12 @@ def async_only_test(f: str) -> bool:
192192
"test_client_context.py",
193193
"test_collation.py",
194194
"test_collection.py",
195+
"test_command_logging.py",
196+
"test_command_monitoring.py",
195197
"test_common.py",
198+
"test_connection_logging.py",
196199
"test_connections_survive_primary_stepdown_spec.py",
200+
"test_crud_unified.py",
197201
"test_csot.py",
198202
"test_cursor.py",
199203
"test_database.py",

0 commit comments

Comments
 (0)