Skip to content

Commit 13a9d7d

Browse files
committed
Resolving conflicts
1 parent 0c45ff6 commit 13a9d7d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/test_003_connection.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
- test_context_manager_connection_closes: Test that context manager closes the connection.
2222
"""
2323

24-
from mssql_python.exceptions import InterfaceError, ProgrammingError
24+
from mssql_python.exceptions import InterfaceError, ProgrammingError, DatabaseError
2525
import mssql_python
26+
import sys
2627
import pytest
2728
import time
2829
from mssql_python import connect, Connection, pooling, SQL_CHAR, SQL_WCHAR
@@ -6380,8 +6381,8 @@ def test_set_attr_edge_cases(db_connection):
63806381

63816382
def test_set_attr_txn_isolation_effect(db_connection):
63826383
"""Test that setting transaction isolation level actually affects transactions."""
6383-
from mssql_python.exceptions import DatabaseError
6384-
conn_str = "Server=tcp:DESKTOP-1A982SC,1433;Database=master;TrustServerCertificate=yes;Trusted_Connection=yes;"
6384+
import os
6385+
conn_str = os.getenv('DB_CONNECTION_STRING')
63856386

63866387
# Create a temporary table for the test
63876388
cursor = db_connection.cursor()
@@ -6463,8 +6464,6 @@ def test_set_attr_txn_isolation_effect(db_connection):
64636464

64646465
def test_set_attr_connection_timeout_effect(db_connection):
64656466
"""Test that setting connection timeout actually affects query timeout."""
6466-
import time
6467-
from mssql_python.exceptions import OperationalError
64686467

64696468
cursor = db_connection.cursor()
64706469
try:
@@ -6505,8 +6504,6 @@ def test_set_attr_connection_timeout_effect(db_connection):
65056504

65066505
def test_set_attr_login_timeout_effect(conn_str):
65076506
"""Test that setting login timeout affects connection time to invalid server."""
6508-
import time
6509-
from mssql_python.exceptions import OperationalError
65106507

65116508
# Testing with a non-existent server to trigger a timeout
65126509
conn_parts = conn_str.split(';')
@@ -6544,7 +6541,6 @@ def test_set_attr_login_timeout_effect(conn_str):
65446541

65456542
def test_set_attr_packet_size_effect(conn_str):
65466543
"""Test that setting packet size affects network packet size."""
6547-
import sys
65486544

65496545
# Some drivers don't support changing packet size after connection
65506546
# Try with explicit packet size in connection string for the first size
@@ -6771,7 +6767,7 @@ def test_attrs_before_connection_types(conn_str):
67716767
cursor = conn.cursor()
67726768
cursor.execute("SELECT DB_NAME()")
67736769
result = cursor.fetchone()[0]
6774-
assert result.lower() == "master"
6770+
assert result.lower() == "testdb"
67756771
conn.close()
67766772

67776773
def test_set_attr_unsupported_attribute(db_connection):

0 commit comments

Comments
 (0)