Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type annotation of lib/tool_shed/test/functional/ #16901

Merged
merged 10 commits into from
Oct 24, 2023

Conversation

nsoranzo
Copy link
Member

@nsoranzo nsoranzo commented Oct 23, 2023

Enable checking of this directory in mypy configuration.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jmchilton
Copy link
Member

Thanks so much. I've been trying to look at the failing tests today and not making much progress. Here's hoping that mypy will give some good indications of the null pointer issues - very nice.

Fix the following mypy error:

```
lib/tool_shed/test/functional/test_0000_basic_repository_features.py:303: error: Item "None" of "ToolShedPopulator | None" has no attribute "get_metadata"  [union-attr]
            metadata = self._populator.get_metadata(repository, downloadable_only=False)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Fix the following mypy error:

```
lib/tool_shed/test/functional/test_shed_tools.py:63: error: Argument 1 to
"tool_guid" of "ToolShedPopulator" has incompatible type "TestShedToolsApi";
expected "HostsTestToolShed"  [arg-type]
            tool_id = populator.tool_guid(self, repository, "Add_a_column1...
                                          ^
lib/tool_shed/test/functional/test_shed_tools.py:63: note: Following member(s) of "TestShedToolsApi" have conflicts:
lib/tool_shed/test/functional/test_shed_tools.py:63: note:     port: expected "int", got "Optional[str]"
```
Fix the following mypy errors:

```
lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py:108: error:
Unexpected keyword argument "filepath" for "commit_tar_to_repository" of
"ShedTwillTestCase"  [call-arg]
                self.commit_tar_to_repository(
                ^
lib/tool_shed/test/base/twilltestcase.py:1156: note: "commit_tar_to_repository" of "ShedTwillTestCase" defined here
lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py:108: error:
Unexpected keyword argument "valid_tools_only" for "commit_tar_to_repository" of
"ShedTwillTestCase"  [call-arg]
                self.commit_tar_to_repository(
                ^
lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py:108: error:
Unexpected keyword argument "uncompress_file" for "commit_tar_to_repository" of
"ShedTwillTestCase"  [call-arg]
                self.commit_tar_to_repository(
                ^
lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py:108: error:
Unexpected keyword argument "remove_repo_files_not_in_tar" for
"commit_tar_to_repository" of "ShedTwillTestCase"  [call-arg]
                self.commit_tar_to_repository(
                ^
lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py:108: error:
Unexpected keyword argument "strings_not_displayed" for
"commit_tar_to_repository" of "ShedTwillTestCase"; did you mean
"strings_displayed"?  [call-arg]
                self.commit_tar_to_repository(
                ^

lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py:170: error:
Need type annotation for "strings_not_displayed_in_iframe" (hint:
"strings_not_displayed_in_iframe: List[<type>] = ...")  [var-annotated]
            strings_not_displayed_in_iframe = []
            ^
```
Fix:

```
lib/tool_shed/test/functional/test_shed_tools.py:30: error: Incompatible types
in assignment (expression has type "BuildSearchIndexResponse", variable has type
"ToolSearchResults")  [assignment]
            response = populator.reindex()
                       ^
lib/tool_shed/test/functional/test_shed_tools.py:31: error: Incompatible types
in assignment (expression has type "BuildSearchIndexResponse", variable has type
"ToolSearchResults")  [assignment]
            response = populator.reindex()
                       ^
```
Fix the following mypy error:

```
lib/tool_shed/test/functional/test_frontend_login.py:76: error: Argument
"redirect" to "login" of "ShedTwillTestCase" has incompatible type "None";
expected "str"  [arg-type]
            self.login(email, TEST_PASSWORD, username=user, redirect=None)
                                                                     ^
```
@nsoranzo nsoranzo marked this pull request as ready for review October 24, 2023 12:11
@github-actions github-actions bot added this to the 23.2 milestone Oct 24, 2023
@nsoranzo
Copy link
Member Author

This is ready for review.

@jmchilton jmchilton merged commit 4f1a207 into galaxyproject:dev Oct 24, 2023
47 of 50 checks passed
@nsoranzo nsoranzo deleted the ts_type_annot branch October 24, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants