|
19 | 19 | pytest_generate_tests hook, call generate_tests. |
20 | 20 | """ |
21 | 21 |
|
| 22 | +import typing |
| 23 | + |
22 | 24 | import adbc_driver_manager.dbapi |
23 | 25 | import pyarrow |
24 | 26 | import pytest |
@@ -60,15 +62,49 @@ def generate_tests(quirks: model.DriverQuirks, metafunc) -> None: |
60 | 62 |
|
61 | 63 | class TestConnection: |
62 | 64 | def test_current_catalog( |
63 | | - self, conn: adbc_driver_manager.dbapi.Connection, driver: model.DriverQuirks |
| 65 | + self, |
| 66 | + driver: model.DriverQuirks, |
| 67 | + conn: adbc_driver_manager.dbapi.Connection, |
64 | 68 | ) -> None: |
65 | 69 | assert conn.adbc_current_catalog == driver.features.current_catalog |
66 | 70 |
|
67 | 71 | def test_current_db_schema( |
68 | | - self, conn: adbc_driver_manager.dbapi.Connection, driver: model.DriverQuirks |
| 72 | + self, |
| 73 | + driver: model.DriverQuirks, |
| 74 | + conn: adbc_driver_manager.dbapi.Connection, |
69 | 75 | ) -> None: |
70 | 76 | assert conn.adbc_current_db_schema == driver.features.current_schema |
71 | 77 |
|
| 78 | + def test_set_current_catalog( |
| 79 | + self, |
| 80 | + driver: model.DriverQuirks, |
| 81 | + conn_factory: typing.Callable[[], adbc_driver_manager.dbapi.Connection], |
| 82 | + ): |
| 83 | + if not driver.features.connection_set_current_catalog: |
| 84 | + pytest.skip("not implemented") |
| 85 | + |
| 86 | + with conn_factory() as conn: |
| 87 | + assert conn.adbc_current_catalog == driver.features.current_catalog |
| 88 | + conn.adbc_current_catalog = driver.features.secondary_catalog |
| 89 | + assert conn.adbc_current_catalog == driver.features.secondary_catalog |
| 90 | + conn.adbc_current_catalog = driver.features.current_catalog |
| 91 | + assert conn.adbc_current_catalog == driver.features.current_catalog |
| 92 | + |
| 93 | + def test_set_current_schema( |
| 94 | + self, |
| 95 | + driver: model.DriverQuirks, |
| 96 | + conn_factory: typing.Callable[[], adbc_driver_manager.dbapi.Connection], |
| 97 | + ): |
| 98 | + if not driver.features.connection_set_current_schema: |
| 99 | + pytest.skip("not implemented") |
| 100 | + |
| 101 | + with conn_factory() as conn: |
| 102 | + assert conn.adbc_current_db_schema == driver.features.current_schema |
| 103 | + conn.adbc_current_db_schema = driver.features.secondary_schema |
| 104 | + assert conn.adbc_current_db_schema == driver.features.secondary_schema |
| 105 | + conn.adbc_current_db_schema = driver.features.current_schema |
| 106 | + assert conn.adbc_current_db_schema == driver.features.current_schema |
| 107 | + |
72 | 108 | def test_get_info( |
73 | 109 | self, conn: adbc_driver_manager.dbapi.Connection, driver: model.DriverQuirks |
74 | 110 | ) -> None: |
|
0 commit comments