You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/16 21:19:47 UTC

[GitHub] [iceberg] Fokko commented on a diff in pull request #6445: Python: Mock home and root folder when running `test_missing_uri`

Fokko commented on code in PR #6445:
URL: https://github.com/apache/iceberg/pull/6445#discussion_r1051172204


##########
python/tests/utils/test_config.py:
##########
@@ -39,7 +40,7 @@ def test_from_environment_variables_uppercase() -> None:
     assert Config().get_catalog_config("PRODUCTION") == {"uri": "https://service.io/api"}
 
 
-def test_from_configuration_files(tmp_path_factory) -> None:  # type: ignore
+def test_from_configuration_files(tmp_path_factory: pytest.TempPathFactory) -> None:

Review Comment:
   Nice!



##########
python/tests/cli/test_console.py:
##########
@@ -134,14 +134,17 @@ def update_namespace_properties(
 MOCK_ENVIRONMENT = {"PYICEBERG_CATALOG__PRODUCTION__URI": "test://doesnotexist"}
 
 
-def test_missing_uri() -> None:
-    runner = CliRunner()
-    result = runner.invoke(run, ["list"])
-    assert result.exit_code == 1
-    assert (
-        result.output
-        == "URI missing, please provide using --uri, the config or environment variable \nPYICEBERG_CATALOG__DEFAULT__URI\n"
-    )
+def test_missing_uri(empty_home_dir_path: str) -> None:

Review Comment:
   This looks good to me! I'd rather use the decorator `@mock.patch.dict(os.environ, MOCK_ENVIRONMENT)` similar as the test below, but I'm aware that we that we can't use the fixture on a global scope.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org