Skip to content

Commit c35a161

Browse files
Fix tests failure because of behavior change of server side error message and error code (#1982)
1 parent 42fa6eb commit c35a161

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

test/integ/test_connection.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
ER_NO_ACCOUNT_NAME,
3434
ER_NOT_IMPLICITY_SNOWFLAKE_DATATYPE,
3535
)
36-
from snowflake.connector.errors import Error, ForbiddenError
36+
from snowflake.connector.errors import Error
3737
from snowflake.connector.network import APPLICATION_SNOWSQL, ReauthenticationRequest
3838
from snowflake.connector.sqlstate import SQLSTATE_FEATURE_NOT_SUPPORTED
3939
from snowflake.connector.telemetry import TelemetryField
@@ -491,8 +491,9 @@ def exe(sql):
491491

492492

493493
@pytest.mark.timeout(15)
494+
@pytest.mark.skipolddriver
494495
def test_invalid_account_timeout():
495-
with pytest.raises(ForbiddenError):
496+
with pytest.raises(OperationalError):
496497
snowflake.connector.connect(
497498
account="bogus", user="test", password="test", login_timeout=5
498499
)
@@ -518,6 +519,7 @@ def test_invalid_proxy(db_parameters):
518519

519520

520521
@pytest.mark.timeout(15)
522+
@pytest.mark.skipolddriver
521523
def test_eu_connection(tmpdir):
522524
"""Tests setting custom region.
523525
@@ -530,7 +532,7 @@ def test_eu_connection(tmpdir):
530532
import os
531533

532534
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED"] = "true"
533-
with pytest.raises(ForbiddenError):
535+
with pytest.raises(OperationalError):
534536
# must reach Snowflake
535537
snowflake.connector.connect(
536538
account="testaccount1234",
@@ -544,6 +546,7 @@ def test_eu_connection(tmpdir):
544546
)
545547

546548

549+
@pytest.mark.skipolddriver
547550
def test_us_west_connection(tmpdir):
548551
"""Tests default region setting.
549552
@@ -553,7 +556,7 @@ def test_us_west_connection(tmpdir):
553556
Notes:
554557
Region is deprecated.
555558
"""
556-
with pytest.raises(ForbiddenError):
559+
with pytest.raises(OperationalError):
557560
# must reach Snowflake
558561
snowflake.connector.connect(
559562
account="testaccount1234",

test/unit/test_connection.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@
2222

2323
import snowflake.connector
2424
from snowflake.connector.connection import DEFAULT_CONFIGURATION
25-
from snowflake.connector.errors import (
26-
Error,
27-
ForbiddenError,
28-
OperationalError,
29-
ProgrammingError,
30-
)
25+
from snowflake.connector.errors import Error, OperationalError, ProgrammingError
3126

3227
from ..randomize import random_string
3328
from .mock_utils import mock_request_with_action, zero_backoff
@@ -344,7 +339,7 @@ def test_invalid_backoff_policy():
344339
# passing a non-generator function should not work
345340
_ = fake_connector(backoff_policy=lambda: None)
346341

347-
with pytest.raises(ForbiddenError):
342+
with pytest.raises(OperationalError):
348343
# passing a generator function should make it pass config and error during connection
349344
_ = fake_connector(backoff_policy=zero_backoff)
350345

0 commit comments

Comments
 (0)