-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16901 from nsoranzo/ts_type_annot
Fix type annotation of ``lib/tool_shed/test/functional/``
- Loading branch information
Showing
57 changed files
with
162 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
Iterator, | ||
List, | ||
Optional, | ||
Tuple, | ||
) | ||
from urllib.parse import ( | ||
quote_plus, | ||
|
@@ -694,7 +695,14 @@ def _submit_register_form(self, email: str, password: str, username: str, redire | |
def invalid_tools_labels(self) -> str: | ||
return "Invalid Tools" if self.is_v2 else "Invalid tools" | ||
|
||
def create(self, cntrller="user", email="[email protected]", password="testuser", username="admin-user", redirect=""): | ||
def create( | ||
self, | ||
cntrller: str = "user", | ||
email: str = "[email protected]", | ||
password: str = "testuser", | ||
username: str = "admin-user", | ||
redirect: Optional[str] = None, | ||
) -> Tuple[bool, bool, bool]: | ||
# HACK: don't use panels because late_javascripts() messes up the twill browser and it | ||
# can't find form fields (and hence user can't be logged in). | ||
params = dict(cntrller=cntrller, use_panels=False) | ||
|
@@ -747,7 +755,7 @@ def login( | |
email: str = "[email protected]", | ||
password: str = "testuser", | ||
username: str = "admin-user", | ||
redirect: str = "", | ||
redirect: Optional[str] = None, | ||
logout_first: bool = True, | ||
explicit_logout: bool = False, | ||
): | ||
|
@@ -916,7 +924,11 @@ def check_repository_changelog(self, repository: Repository, strings_displayed=N | |
self.check_for_strings(strings_displayed, strings_not_displayed) | ||
|
||
def check_repository_dependency( | ||
self, repository: Repository, depends_on_repository, depends_on_changeset_revision=None, changeset_revision=None | ||
self, | ||
repository: Repository, | ||
depends_on_repository: Repository, | ||
depends_on_changeset_revision=None, | ||
changeset_revision=None, | ||
): | ||
if not self.is_v2: | ||
# v2 doesn't display repository repository dependencies, they are deprecated | ||
|
@@ -1042,8 +1054,9 @@ def commit_and_push(self, repository, hgrepo, options, username, password): | |
|
||
def create_category(self, **kwd) -> Category: | ||
category_name = kwd["name"] | ||
category = self.populator.get_category_with_name(category_name) | ||
if category is None: | ||
try: | ||
category = self.populator.get_category_with_name(category_name) | ||
except ValueError: | ||
# not recreating this functionality in the UI I don't think? | ||
category = self.populator.new_category(category_name) | ||
return category | ||
|
@@ -1413,7 +1426,7 @@ def get_repositories_category_api( | |
|
||
def get_or_create_repository( | ||
self, category: Category, owner: str, name: str, strings_displayed=None, strings_not_displayed=None, **kwd | ||
) -> Optional[Repository]: | ||
) -> Repository: | ||
# If not checking for a specific string, it should be safe to assume that | ||
# we expect repository creation to be successful. | ||
if strings_displayed is None: | ||
|
@@ -1428,6 +1441,7 @@ def get_or_create_repository( | |
self.submit_form(button="create_repository_button", name=name, category_id=category_id, **kwd) | ||
self.check_for_strings(strings_displayed, strings_not_displayed) | ||
repository = self.populator.get_repository_for(owner, name) | ||
assert repository | ||
return repository | ||
|
||
def get_repo_path(self, repository: Repository) -> str: | ||
|
@@ -1506,10 +1520,11 @@ def get_repository_metadata_revisions(self, repository: Repository) -> List[str] | |
for repository_metadata in self._db_repository(repository).metadata_revisions | ||
] | ||
|
||
def _get_repository_by_name_and_owner(self, name: str, owner: str) -> Optional[Repository]: | ||
def _get_repository_by_name_and_owner(self, name: str, owner: str) -> Repository: | ||
repo = self.populator.get_repository_for(owner, name) | ||
if repo is None: | ||
repo = self.populator.get_repository_for(owner, name, deleted="true") | ||
assert repo | ||
return repo | ||
|
||
def get_repository_tip(self, repository: Repository) -> str: | ||
|
@@ -1596,7 +1611,6 @@ def _install_repository( | |
) -> None: | ||
self.browse_tool_shed(url=self.url) | ||
category = self.populator.get_category_with_name(category_name) | ||
assert category | ||
self.browse_category(category) | ||
self.preview_repository_in_tool_shed(name, owner, strings_displayed=preview_strings_displayed) | ||
repository = self._get_repository_by_name_and_owner(name, owner) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0020_basic_repository_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0030_repository_dependency_revisions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0040_repository_circular_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0080_advanced_circular_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0100_complex_repository_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0110_invalid_simple_repository_dependencies.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0120_simple_repository_dependency_multiple_owners.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0150_prior_installation_required.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0160_circular_prior_installation_required.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
lib/tool_shed/test/functional/test_0170_complex_prior_installation_required.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.