codeant-ai-for-open-source[bot] commented on code in PR #40994:
URL: https://github.com/apache/superset/pull/40994#discussion_r3402185484


##########
tests/integration_tests/cli_tests.py:
##########
@@ -364,3 +364,56 @@ def 
test_re_encrypt_secrets_failure_exits_nonzero(app_context):
     # The failure path must be handled by the CLI, not leaked as an
     # uncaught exception.
     assert response.exception is None or isinstance(response.exception, 
SystemExit)
+
+
[email protected]("superset.examples.utils.load_configs_from_directory")
+def test_import_directory(load_configs_mock, app_context, fs):
+    """
+    Test that import-directory calls load_configs_from_directory with the
+    correct arguments and assigns assets to the specified user.
+    """
+    # pylint: disable=reimported, redefined-outer-name
+    import superset.cli.importexport  # noqa: F811
+
+    importlib.reload(superset.cli.importexport)
+
+    fs.create_dir("/assets")
+    fs.create_file("/assets/metadata.yaml", contents="version: 1.0.0\n")
+
+    runner = current_app.test_cli_runner()
+    response = runner.invoke(
+        superset.cli.importexport.import_directory,
+        ("/assets", "-u", "admin"),
+    )
+
+    assert response.exit_code == 0
+    load_configs_mock.assert_called_once()
+    call_kwargs = load_configs_mock.call_args
+    assert str(call_kwargs.kwargs["root"]) == "/assets"
+    assert call_kwargs.kwargs["overwrite"] is False
+    assert call_kwargs.kwargs["force_data"] is False
+
+
[email protected](
+    "superset.examples.utils.load_configs_from_directory",
+    side_effect=Exception(),
+)
+def test_failing_import_directory(load_configs_mock, app_context, fs, caplog):

Review Comment:
   **Suggestion:** Add explicit type hints for each function argument and the 
return type in this new test function to satisfy the typing rule for newly 
introduced Python code. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly introduced Python test function without any parameter 
annotations or return type annotation. That directly violates the rule that new 
Python code should be fully typed.
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=19c4ecbbeca943078870f814872b1162&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=19c4ecbbeca943078870f814872b1162&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/integration_tests/cli_tests.py
   **Line:** 401:401
   **Comment:**
        *Custom Rule: Add explicit type hints for each function argument and 
the return type in this new test function to satisfy the typing rule for newly 
introduced Python code.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=4483e6a5b4ae24289038138e30f85eca2309d91b70777934505fc5115e89f943&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=4483e6a5b4ae24289038138e30f85eca2309d91b70777934505fc5115e89f943&reaction=dislike'>👎</a>



##########
tests/integration_tests/cli_tests.py:
##########
@@ -364,3 +364,56 @@ def 
test_re_encrypt_secrets_failure_exits_nonzero(app_context):
     # The failure path must be handled by the CLI, not leaked as an
     # uncaught exception.
     assert response.exception is None or isinstance(response.exception, 
SystemExit)
+
+
[email protected]("superset.examples.utils.load_configs_from_directory")
+def test_import_directory(load_configs_mock, app_context, fs):

Review Comment:
   **Suggestion:** Add explicit type hints for all parameters and the return 
value in this newly added test function so it complies with the requirement 
that new Python code is fully typed. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added Python test function, and its parameters and return 
type are unannotated. The rule requires new Python code to be fully typed, so 
this is a real violation.
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6947d1ebc43c49a9a97c7f81ac6ef4b5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6947d1ebc43c49a9a97c7f81ac6ef4b5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/integration_tests/cli_tests.py
   **Line:** 370:370
   **Comment:**
        *Custom Rule: Add explicit type hints for all parameters and the return 
value in this newly added test function so it complies with the requirement 
that new Python code is fully typed.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=6c7fcb7acfbaa4f4ad8b6d4c74f804d8a0470383994186ec67fb432c982d2d84&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=6c7fcb7acfbaa4f4ad8b6d4c74f804d8a0470383994186ec67fb432c982d2d84&reaction=dislike'>👎</a>



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