Skip to content

Commit 4426e1f

Browse files
Skip old driver test in test_easy_logging.py (#1920)
1 parent bd2e62b commit 4426e1f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/unit/test_easy_logging.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#
22
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
33
#
4+
import pytest
5+
6+
pytestmark = pytest.mark.skipolddriver
7+
48
import os.path
59
import platform
610
from logging import getLogger
711
from pathlib import Path
812

9-
import pytest
10-
import tomlkit
13+
try:
14+
import tomlkit
15+
16+
from snowflake.connector import EasyLoggingConfigPython
17+
from snowflake.connector.config_manager import CONFIG_MANAGER
18+
from snowflake.connector.constants import CONFIG_FILE
19+
except ModuleNotFoundError:
20+
pass
1121

1222
import snowflake.connector
13-
from snowflake.connector import EasyLoggingConfigPython
14-
from snowflake.connector.config_manager import CONFIG_MANAGER
15-
from snowflake.connector.constants import CONFIG_FILE
1623

1724
logger = getLogger("snowflake.connector")
1825

@@ -88,23 +95,20 @@ def config_file_setup(
8895

8996

9097
@pytest.mark.parametrize("config_file_setup", ["nonexist_path"], indirect=True)
91-
@pytest.mark.skipolddriver
9298
def test_config_file_nonexist_path(config_file_setup, nonexist_file):
9399
assert not os.path.exists(nonexist_file)
94100
EasyLoggingConfigPython()
95101
assert os.path.exists(nonexist_file)
96102

97103

98104
@pytest.mark.parametrize("config_file_setup", ["inabsolute_path"], indirect=True)
99-
@pytest.mark.skipolddriver
100105
def test_config_file_inabsolute_path(config_file_setup, inabsolute_file):
101106
with pytest.raises(FileNotFoundError) as e:
102107
EasyLoggingConfigPython()
103108
assert f"Log path must be an absolute file path: {str(inabsolute_file)}" in str(e)
104109

105110

106111
@pytest.mark.parametrize("config_file_setup", ["inaccessible_path"], indirect=True)
107-
@pytest.mark.skipolddriver
108112
@pytest.mark.skipif(
109113
platform.system() == "Windows", reason="Test only applicable to Windows"
110114
)
@@ -118,7 +122,6 @@ def test_config_file_inaccessible_path(config_file_setup, inaccessible_file):
118122

119123

120124
@pytest.mark.parametrize("config_file_setup", ["save_logs"], indirect=True)
121-
@pytest.mark.skipolddriver
122125
def test_save_logs(config_file_setup, log_directory):
123126
easy_logging = EasyLoggingConfigPython()
124127
easy_logging.create_log()
@@ -134,7 +137,6 @@ def test_save_logs(config_file_setup, log_directory):
134137

135138

136139
@pytest.mark.parametrize("config_file_setup", ["no_save_logs"], indirect=True)
137-
@pytest.mark.skipolddriver
138140
def test_no_save_logs(config_file_setup, log_directory):
139141
easy_logging = EasyLoggingConfigPython()
140142
easy_logging.create_log()

0 commit comments

Comments
 (0)