|
| 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 Transactions 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 client_context, unittest |
| 25 | +from test.asynchronous.unified_format import generate_test_classes |
| 26 | + |
| 27 | +_IS_SYNC = False |
| 28 | + |
| 29 | + |
| 30 | +@client_context.require_no_mmap |
| 31 | +def setUpModule(): |
| 32 | + pass |
| 33 | + |
| 34 | + |
| 35 | +# Location of JSON test specifications. |
| 36 | +if _IS_SYNC: |
| 37 | + TEST_PATH = os.path.join(Path(__file__).resolve().parent, "transactions/unified") |
| 38 | +else: |
| 39 | + TEST_PATH = os.path.join(Path(__file__).resolve().parent.parent, "transactions/unified") |
| 40 | + |
| 41 | +# Generate unified tests. |
| 42 | +globals().update(generate_test_classes(TEST_PATH, module=__name__)) |
| 43 | + |
| 44 | +# Location of JSON test specifications for transactions-convenient-api. |
| 45 | +if _IS_SYNC: |
| 46 | + TEST_PATH = os.path.join(Path(__file__).resolve().parent, "transactions-convenient-api/unified") |
| 47 | +else: |
| 48 | + TEST_PATH = os.path.join( |
| 49 | + Path(__file__).resolve().parent.parent, "transactions-convenient-api/unified" |
| 50 | + ) |
| 51 | + |
| 52 | +# Generate unified tests. |
| 53 | +globals().update(generate_test_classes(TEST_PATH, module=__name__)) |
| 54 | + |
| 55 | +if __name__ == "__main__": |
| 56 | + unittest.main() |
0 commit comments