Skip to content

Commit 2eeb6ad

Browse files
committed
tests: fix up mypy issues on tests
1 parent a72d478 commit 2eeb6ad

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

pyiceberg/utils/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def _load_yaml(directory: Optional[str]) -> Optional[RecursiveDict]:
8585
return None
8686

8787
# Directories to search for the configuration file
88+
# The current search order is: PYICEBERG_HOME, home directory, then current directory
8889
search_dirs = [os.environ.get(PYICEBERG_HOME), os.path.expanduser("~"), os.getcwd()]
8990

9091
for directory in search_dirs:

tests/utils/test_config.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
import os
18+
from typing import Any, Dict, Optional
1819
from unittest import mock
1920

2021
import pytest
@@ -117,9 +118,13 @@ def test_from_configuration_files_get_typed_value(tmp_path_factory: pytest.TempP
117118
],
118119
)
119120
def test_from_multiple_configuration_files(
120-
monkeypatch: pytest.MonkeyPatch, tmp_path_factory: pytest.TempPathFactory, config_location, config_content, expected_result
121-
):
122-
def create_config_file(directory: str, content: dict) -> None:
121+
monkeypatch: pytest.MonkeyPatch,
122+
tmp_path_factory: pytest.TempPathFactory,
123+
config_location: str,
124+
config_content: Optional[Dict[str, Any]],
125+
expected_result: Optional[Dict[str, Any]],
126+
) -> None:
127+
def create_config_file(directory: str, content: Optional[Dict[str, Any]]) -> None:
123128
config_file_path = os.path.join(directory, ".pyiceberg.yaml")
124129
with open(config_file_path, "w", encoding="utf-8") as file:
125130
yaml_str = as_document(content).as_yaml() if content else ""
@@ -144,6 +149,6 @@ def create_config_file(directory: str, content: dict) -> None:
144149
if config_location == "current":
145150
monkeypatch.chdir(current_path)
146151

147-
assert (
148-
Config()._from_configuration_files() == expected_result
149-
), f"Unexpected configuration result for content: {config_content}"
152+
assert Config()._from_configuration_files() == expected_result, (
153+
f"Unexpected configuration result for content: {config_content}"
154+
)

0 commit comments

Comments
 (0)