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 2023/01/17 08:43:22 UTC

[GitHub] [iceberg] arminnajafi opened a new pull request, #6607: Python: Fix `test_missing_uri` unit test

arminnajafi opened a new pull request, #6607:
URL: https://github.com/apache/iceberg/pull/6607

   When running `make test` on mainline branch `test_missing_uri` unit test fails with:
   
   ```
   empty_home_dir_path = '/private/var/folders/wz/yzqdwvrx0cj1j1h5c3g59rm40000gr/T/pytest-of-najarmin/pytest-22/home0'
   
       def test_missing_uri(empty_home_dir_path: str) -> None:
       
           # mock to prevent parsing ~/.pyiceberg.yaml or {PYICEBERG_HOME}/.pyiceberg.yaml
           with mock.patch.dict(os.environ, {"HOME": empty_home_dir_path, "PYICEBERG_HOME": empty_home_dir_path}):
               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"
               )
   E           AssertionError: assert 'You must specify a region.\n' == 'URI missing,...EFAULT__URI\n'
   E             + You must specify a region.
   E             - URI missing, please provide using --uri, the config or environment variable 
   E             - PYICEBERG_CATALOG__DEFAULT__URI
   
   tests/cli/test_console.py:144: AssertionError
   ```
   
   This is because in the PR that introduces this change (https://github.com/apache/iceberg/pull/6445) needs one more patch. This is because before we get to the below patch line:
   
   ```
   # mock to prevent parsing ~/.pyiceberg.yaml or {PYICEBERG_HOME}/.pyiceberg.yaml
   with mock.patch.dict(os.environ, {"HOME": empty_home_dir_path, "PYICEBERG_HOME": empty_home_dir_path}):
   ```
   
   `_ENV_CONFIG` is already loaded as part of imports statements in the `test_console.py` file using the real `$HOME` env:
   
   https://github.com/apache/iceberg/blob/596d7b876dcd9a9d5a5242622e3abaf8f069f3dc/python/pyiceberg/catalog/__init__.py#L51
   
   Therefore a new patch is needed before we call the CLI:
   ```
   with mock.patch('pyiceberg.catalog._ENV_CONFIG', Config()):
   ```
   
   Just FYI the original config file is as follows at the time of producing this issue:
   
   ```
   > cat ~/.pyiceberg.yaml 
   catalog:
     default:
       type: glue
   ```
   
   


-- 
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


[GitHub] [iceberg] Fokko merged pull request #6607: Python: Fix `test_missing_uri` unit test

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #6607:
URL: https://github.com/apache/iceberg/pull/6607


-- 
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