Skip to content

Commit

Permalink
Type annotation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Oct 19, 2023
1 parent 5858482 commit 374c45e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/tool_shed/test/base/twilltestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def create_category(self, **kwd) -> Category:

def create_repository_dependency(
self,
repository: Optional[Repository] = None,
repository: Repository,
repository_tuples=None,
filepath=None,
prior_installation_required=False,
Expand All @@ -1050,7 +1050,6 @@ def create_repository_dependency(
strings_displayed=None,
strings_not_displayed=None,
):
assert repository
repository_tuples = repository_tuples or []
repository_names = []
if complex:
Expand Down
34 changes: 32 additions & 2 deletions lib/tool_shed/test/functional/test_0300_reset_all_metadata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Dict

from ..base.twilltestcase import (
common,
ShedTwillTestCase,
Expand Down Expand Up @@ -63,6 +65,7 @@ def test_0005_create_filtering_repository(self):
owner=common.test_user_1_name,
category=category_0000,
)
assert repository
if self.repository_is_new(repository):
running_standalone = True
self.commit_tar_to_repository(
Expand Down Expand Up @@ -90,6 +93,7 @@ def test_0010_create_freebayes_repository(self):
strings_displayed=[],
)
if running_standalone:
assert repository
self.setup_freebayes_0010_repo(repository)

def test_0015_create_datatypes_0020_repository(self):
Expand All @@ -110,6 +114,7 @@ def test_0015_create_datatypes_0020_repository(self):
category=category_0020,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"column_maker/column_maker.tar",
Expand All @@ -134,6 +139,7 @@ def test_0020_create_emboss_0020_repository(self):
category=category_0020,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"emboss/emboss.tar",
Expand All @@ -158,6 +164,7 @@ def test_0025_create_emboss_datatypes_0030_repository(self):
category=category_0030,
strings_displayed=[],
)
assert column_maker_repository
self.commit_tar_to_repository(
column_maker_repository,
"column_maker/column_maker.tar",
Expand All @@ -182,6 +189,7 @@ def test_0030_create_emboss_5_repository(self):
category=category_0030,
strings_displayed=[],
)
assert emboss_5_repository
self.commit_tar_to_repository(
emboss_5_repository,
"emboss/emboss.tar",
Expand All @@ -206,6 +214,7 @@ def test_0035_create_emboss_6_repository(self):
category=category_0030,
strings_displayed=[],
)
assert emboss_6_repository
self.commit_tar_to_repository(
emboss_6_repository,
"emboss/emboss.tar",
Expand All @@ -230,6 +239,7 @@ def test_0040_create_emboss_0030_repository(self):
category=category_0030,
strings_displayed=[],
)
assert emboss_repository
self.commit_tar_to_repository(
emboss_repository,
"emboss/emboss.tar",
Expand All @@ -243,9 +253,13 @@ def test_0045_create_repository_dependencies_for_0030(self):
column_maker_repository = self._get_repository_by_name_and_owner(
"column_maker_0030", common.test_user_1_name
)
assert column_maker_repository
emboss_repository = self._get_repository_by_name_and_owner("emboss_0030", common.test_user_1_name)
assert emboss_repository
emboss_5_repository = self._get_repository_by_name_and_owner("emboss_5_0030", common.test_user_1_name)
assert emboss_5_repository
emboss_6_repository = self._get_repository_by_name_and_owner("emboss_6_0030", common.test_user_1_name)
assert emboss_6_repository
repository_dependencies_path = self.generate_temp_path("test_0330", additional_paths=["emboss"])
column_maker_tuple = (
self.url,
Expand Down Expand Up @@ -299,6 +313,7 @@ def test_0050_create_freebayes_repository(self):
category=category_0040,
strings_displayed=[],
)
assert repository
if running_standalone:
self.commit_tar_to_repository(
repository,
Expand All @@ -324,6 +339,7 @@ def test_0055_create_filtering_repository(self):
category=category_0040,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"filtering/filtering_1.1.0.tar",
Expand All @@ -335,7 +351,9 @@ def test_0060_create_dependency_structure(self):
global running_standalone
if running_standalone:
freebayes_repository = self._get_repository_by_name_and_owner("freebayes_0040", common.test_user_1_name)
assert freebayes_repository
filtering_repository = self._get_repository_by_name_and_owner("filtering_0040", common.test_user_1_name)
assert filtering_repository
repository_dependencies_path = self.generate_temp_path("test_0340", additional_paths=["dependencies"])
freebayes_tuple = (
self.url,
Expand Down Expand Up @@ -375,6 +393,7 @@ def test_0065_create_convert_repository(self):
category=category,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"convert_chars/convert_chars.tar",
Expand All @@ -396,6 +415,7 @@ def test_0070_create_column_repository(self):
category=category,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"column_maker/column_maker.tar",
Expand All @@ -420,6 +440,7 @@ def test_0080_create_emboss_repository(self):
category=category,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"emboss/emboss.tar",
Expand All @@ -441,6 +462,7 @@ def test_0085_create_filtering_repository(self):
category=category,
strings_displayed=[],
)
assert filtering_repository
self.commit_tar_to_repository(
filtering_repository,
"filtering/filtering_1.1.0.tar",
Expand All @@ -462,6 +484,7 @@ def test_0090_create_freebayes_repository(self):
category=category,
strings_displayed=[],
)
assert repository
self.commit_tar_to_repository(
repository,
"freebayes/freebayes.tar",
Expand All @@ -483,6 +506,7 @@ def test_0095_create_bismark_repository(self):
category=category,
strings_displayed=[],
)
assert repository
self.user_populator().setup_bismark_repo(repository, end=1)

def test_0100_create_and_upload_dependency_definitions(self):
Expand All @@ -491,19 +515,25 @@ def test_0100_create_and_upload_dependency_definitions(self):
if running_standalone:
self.login(email=common.test_user_1_email, username=common.test_user_1_name)
column_repository = self._get_repository_by_name_and_owner(column_repository_name, common.test_user_1_name)
assert column_repository
convert_repository = self._get_repository_by_name_and_owner(
convert_repository_name, common.test_user_1_name
)
assert convert_repository
emboss_repository = self._get_repository_by_name_and_owner(emboss_repository_name, common.test_user_1_name)
assert emboss_repository
filtering_repository = self._get_repository_by_name_and_owner(
filtering_repository_name, common.test_user_1_name
)
assert filtering_repository
freebayes_repository = self._get_repository_by_name_and_owner(
freebayes_repository_name, common.test_user_1_name
)
assert freebayes_repository
bismark_repository = self._get_repository_by_name_and_owner(
bismark_repository_name, common.test_user_1_name
)
assert bismark_repository
dependency_xml_path = self.generate_temp_path("test_0050", additional_paths=["freebayes"])
# convert_chars depends on column_maker
# column_maker depends on convert_chars
Expand Down Expand Up @@ -562,8 +592,8 @@ def test_0100_create_and_upload_dependency_definitions(self):
def test_0110_reset_metadata_on_all_repositories(self):
"""Reset metadata on all repositories, then verify that it has not changed."""
self.login(email=common.admin_email, username=common.admin_username)
old_metadata = dict()
new_metadata = dict()
old_metadata: Dict[str, Dict] = dict()
new_metadata: Dict[str, Dict] = dict()
repositories = self.test_db_util.get_all_repositories()
for repository in repositories:
old_metadata[self.security.encode_id(repository.id)] = dict()
Expand Down

0 comments on commit 374c45e

Please sign in to comment.