sadpandajoe opened a new issue, #45170:
URL: https://github.com/apache/superset/issues/45170

   **Problem**
   The nightly full-repo mypy run fails on 
`tests/unit_tests/dao/key_value_test.py`. First failing run: 
https://github.com/apache/superset/actions/runs/38030733332/job/114150947624
   
   ```
   tests/unit_tests/dao/key_value_test.py:216: error: Argument "key" to 
"get_entry" of "KeyValueDAO" has incompatible type "UUID | None"; expected "int 
| UUID"  [arg-type]
   ```
   
   It only shows up when `superset_core` is included on mypy's command line (a 
full-repo run), since `pyproject.toml` sets `follow_imports = "skip"` for 
`superset_core.*` and command-line files bypass that.
   
   **Root cause**
   `test_get_entry_shared_lock` in `tests/unit_tests/dao/key_value_test.py` 
(added by #45102, commit cb8ff2885a) passes `key_value_entry.uuid` directly to 
`KeyValueDAO.get_entry` (`superset/daos/key_value.py:42`), whose `key` param is 
typed `Key = int | UUID` (`superset/key_value/types.py:37`), with no `None`. 
`key_value_entry.uuid` is typed `UUID | None` (inherited from 
`superset_core.common.models.KeyValue`). An identical case three tests earlier 
in the same file, `test_get_uuid_entry`, guards with `assert 
key_value_entry.uuid is not None` before the same call; 
`test_get_entry_shared_lock` is missing that guard.
   
   **Steps to reproduce**
   1. Check out master at commit 97ce269b9623b629ef99e9ff0f49947835b86b0d (or 
later, prior to the fix)
   2. Run `pre-commit run mypy --all-files`
   3. Observe the `arg-type` error at 
`tests/unit_tests/dao/key_value_test.py:216`
   
   (Found via automated investigation — [Agor](https://agor.live/).)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to