sadpandajoe commented on code in PR #42821:
URL: https://github.com/apache/superset/pull/42821#discussion_r3779766907


##########
tests/unit_tests/db_engine_specs/test_mysql.py:
##########
@@ -280,14 +334,14 @@ def test_get_datatype_pymysql_fallback():
     try:
         # Build a fake pymysql module with constants.FIELD_TYPE
         fake_field_type = ModuleType("pymysql.constants.FIELD_TYPE")
-        fake_field_type.TINY = 1
-        fake_field_type.VARCHAR = 15
+        setattr(fake_field_type, "TINY", 1)  # noqa: B010

Review Comment:
   Fixed — switched the fake pymysql/mysql-connector objects from 
`types.ModuleType` to `types.SimpleNamespace`. `ModuleType` needs `setattr()` 
because mypy flags plain attribute assignment on it as `attr-defined`, which is 
what the `noqa: B010` was suppressing. `SimpleNamespace` supports normal 
attribute construction/access under mypy, so no `setattr()` or lint suppression 
is needed at all.



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