Skip to content

Commit 5a99af8

Browse files
committed
Fix tests
1 parent 19609fc commit 5a99af8

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

tests/integration/drivers/test_driver_install.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def run_command(command: str) -> tuple[int, str, str]:
2727
return result.returncode, result.stdout, result.stderr
2828

2929

30-
def test_no_driver_initially() -> bool:
30+
def check_no_driver_initially() -> bool:
3131
log("Step 1: Checking that no ODBC driver is installed initially...")
3232

3333
from sqlit.drivers import get_installed_drivers
@@ -41,7 +41,7 @@ def test_no_driver_initially() -> bool:
4141
return True
4242

4343

44-
def test_get_install_commands() -> list[str] | None:
44+
def get_install_commands_for_os() -> list[str] | None:
4545
log("Step 2: Getting installation commands for this OS...")
4646

4747
from sqlit.drivers import get_install_commands, get_os_info
@@ -65,7 +65,7 @@ def test_get_install_commands() -> list[str] | None:
6565
return install_cmd.commands
6666

6767

68-
def test_execute_install_commands(commands: list[str]) -> bool:
68+
def execute_install_commands(commands: list[str]) -> bool:
6969
log("Step 3: Executing installation commands...")
7070

7171
for i, command in enumerate(commands, 1):
@@ -94,7 +94,7 @@ def test_execute_install_commands(commands: list[str]) -> bool:
9494
return True
9595

9696

97-
def test_driver_installed() -> str | None:
97+
def verify_driver_installed() -> str | None:
9898
log("Step 4: Verifying driver is now installed...")
9999

100100
import sqlit.drivers
@@ -114,7 +114,7 @@ def test_driver_installed() -> str | None:
114114
return best
115115

116116

117-
def test_connection(driver: str) -> bool:
117+
def verify_connection(driver: str) -> bool:
118118
log("Step 5: Testing connection to SQL Server...")
119119

120120
host = os.environ.get("MSSQL_HOST", "localhost")
@@ -173,21 +173,21 @@ def main() -> int:
173173
distro = os.environ.get("DISTRO_NAME", "unknown")
174174
log(f"Testing on: {distro}")
175175

176-
if not test_no_driver_initially():
176+
if not check_no_driver_initially():
177177
return 1
178178

179-
commands = test_get_install_commands()
179+
commands = get_install_commands_for_os()
180180
if commands is None:
181181
return 1
182182

183-
if not test_execute_install_commands(commands):
183+
if not execute_install_commands(commands):
184184
return 1
185185

186-
driver = test_driver_installed()
186+
driver = verify_driver_installed()
187187
if driver is None:
188188
return 1
189189

190-
if not test_connection(driver):
190+
if not verify_connection(driver):
191191
return 1
192192

193193
log("=" * 60)
@@ -196,5 +196,20 @@ def main() -> int:
196196
return 0
197197

198198

199+
def test_driver_install_integration() -> None:
200+
"""Run the full driver installation integration test.
201+
202+
This test is skipped unless MSSQL_PASSWORD is set, indicating
203+
we're running in the proper CI environment with Docker.
204+
"""
205+
import pytest
206+
207+
if not os.environ.get("MSSQL_PASSWORD"):
208+
pytest.skip("MSSQL_PASSWORD not set - skipping integration test")
209+
210+
result = main()
211+
assert result == 0, "Driver installation integration test failed"
212+
213+
199214
if __name__ == "__main__":
200215
sys.exit(main())

0 commit comments

Comments
 (0)