File tree 3 files changed +49
-1
lines changed 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change
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 Sessions unified spec tests."""
16
+ from __future__ import annotations
17
+
18
+ import os
19
+ import sys
20
+ from pathlib import Path
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 (Path (__file__ ).resolve ().parent , "sessions" )
32
+ else :
33
+ TEST_PATH = os .path .join (Path (__file__ ).resolve ().parent .parent , "sessions" )
34
+
35
+
36
+ # Generate unified tests.
37
+ globals ().update (generate_test_classes (TEST_PATH , module = __name__ ))
38
+
39
+ if __name__ == "__main__" :
40
+ unittest .main ()
Original file line number Diff line number Diff line change 17
17
18
18
import os
19
19
import sys
20
+ from pathlib import Path
20
21
21
22
sys .path [0 :0 ] = ["" ]
22
23
23
24
from test import unittest
24
25
from test .unified_format import generate_test_classes
25
26
27
+ _IS_SYNC = True
28
+
26
29
# Location of JSON test specifications.
27
- TEST_PATH = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "sessions" )
30
+ if _IS_SYNC :
31
+ TEST_PATH = os .path .join (Path (__file__ ).resolve ().parent , "sessions" )
32
+ else :
33
+ TEST_PATH = os .path .join (Path (__file__ ).resolve ().parent .parent , "sessions" )
34
+
28
35
29
36
# Generate unified tests.
30
37
globals ().update (generate_test_classes (TEST_PATH , module = __name__ ))
Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ def async_only_test(f: str) -> bool:
228
228
"test_retryable_writes_unified.py" ,
229
229
"test_run_command.py" ,
230
230
"test_session.py" ,
231
+ "test_sessions_unified.py" ,
231
232
"test_srv_polling.py" ,
232
233
"test_ssl.py" ,
233
234
"test_transactions.py" ,
You can’t perform that action at this time.
0 commit comments