From 0cd32e59f756032083464ef9be77e71c1a95a02f Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Mon, 23 Oct 2023 14:48:59 +0100 Subject: [PATCH 01/10] Fix ``exclude`` regexp in mypy configuration to not exclude the `lib/tool_shed/test/functional/` directory. --- mypy.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index fe479abe7da6..f9212dbd4e26 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,7 +4,11 @@ plugins = pydantic.mypy show_error_codes = True ignore_missing_imports = True check_untyped_defs = True -exclude = lib/galaxy/tools/bundled|test/functional|.*tool_shed/test/test_data/repos +exclude = (?x)( + ^lib/galaxy/tools/bundled + | ^test/functional + | .*tool_shed/test/test_data/repos + ) pretty = True no_implicit_reexport = True no_implicit_optional = True From d8cdf58410b5509eb2cae59721c942e42cce6717 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 10:35:20 +0100 Subject: [PATCH 02/10] Fix use of non re-exported import --- .../test/functional/test_0000_basic_repository_features.py | 6 ++---- .../test_0010_repository_with_tool_dependencies.py | 6 ++---- .../functional/test_0020_basic_repository_dependencies.py | 6 ++---- .../functional/test_0030_repository_dependency_revisions.py | 6 ++---- .../test_0040_repository_circular_dependencies.py | 6 ++---- .../functional/test_0050_circular_dependencies_4_levels.py | 6 ++---- lib/tool_shed/test/functional/test_0070_invalid_tool.py | 6 ++---- .../functional/test_0080_advanced_circular_dependencies.py | 6 ++---- lib/tool_shed/test/functional/test_0090_tool_search.py | 6 ++---- .../functional/test_0100_complex_repository_dependencies.py | 6 ++---- .../test_0110_invalid_simple_repository_dependencies.py | 6 ++---- ...est_0120_simple_repository_dependency_multiple_owners.py | 6 ++---- lib/tool_shed/test/functional/test_0140_tool_help_images.py | 6 ++---- .../functional/test_0150_prior_installation_required.py | 6 ++---- .../test_0160_circular_prior_installation_required.py | 6 ++---- .../test_0170_complex_prior_installation_required.py | 6 ++---- .../test/functional/test_0300_reset_all_metadata.py | 6 ++---- lib/tool_shed/test/functional/test_0310_hg_api_features.py | 6 ++---- .../functional/test_0420_citable_urls_for_repositories.py | 6 ++---- lib/tool_shed/test/functional/test_0430_browse_utilities.py | 6 ++---- .../functional/test_0440_deleting_dependency_definitions.py | 6 ++---- .../test/functional/test_0460_upload_to_repository.py | 6 ++---- .../functional/test_0470_tool_dependency_repository_type.py | 6 ++---- .../test_0480_tool_dependency_xml_verification.py | 6 ++---- .../test/functional/test_0530_repository_admin_feature.py | 6 ++---- .../functional/test_0550_metadata_updated_dependencies.py | 6 ++---- .../test/functional/test_1000_install_basic_repository.py | 6 ++---- .../test_1010_install_repository_with_tool_dependencies.py | 6 ++---- ..._1020_install_repository_with_repository_dependencies.py | 6 ++---- ...est_1030_install_repository_with_dependency_revisions.py | 6 ++---- ...t_1040_install_repository_basic_circular_dependencies.py | 6 ++---- .../functional/test_1050_circular_dependencies_4_levels.py | 6 ++---- lib/tool_shed/test/functional/test_1070_invalid_tool.py | 6 ++---- .../test_1080_advanced_circular_dependency_installation.py | 6 ++---- .../functional/test_1090_repository_dependency_handling.py | 6 ++---- .../test_1100_install_updated_repository_dependencies.py | 6 ++---- ...est_1120_install_repository_with_complex_dependencies.py | 6 ++---- ...install_repository_with_invalid_repository_dependency.py | 6 ++---- ...est_1140_simple_repository_dependency_multiple_owners.py | 6 ++---- lib/tool_shed/test/functional/test_1160_tool_help_images.py | 6 ++---- .../functional/test_1170_prior_installation_required.py | 6 ++---- .../test_1180_circular_prior_installation_required.py | 6 ++---- .../test_1190_complex_prior_installation_required.py | 6 ++---- .../test_1200_uninstall_and_reinstall_basic_repository.py | 6 ++---- ...uninstall_reinstall_repository_with_tool_dependencies.py | 6 ++---- ...nstall_reinstall_repository_with_dependency_revisions.py | 6 ++---- .../test/functional/test_1300_reset_all_metadata.py | 6 ++---- lib/tool_shed/test/functional/test_1410_update_manager.py | 6 ++---- .../functional/test_1430_repair_installed_repository.py | 6 ++---- lib/tool_shed/test/functional/test_1460_data_managers.py | 6 ++---- .../functional/test_1470_updating_installed_repositories.py | 6 ++---- 51 files changed, 102 insertions(+), 204 deletions(-) diff --git a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py index c34727257c17..c01c91d731ec 100644 --- a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py +++ b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py @@ -1,10 +1,8 @@ import logging +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase repository_name = "filtering_0000" repository_description = "Galaxy's filtering tool for test 0000" diff --git a/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py b/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py index 4b9d27ae19d7..167571983521 100644 --- a/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py +++ b/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py @@ -1,10 +1,8 @@ import os +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase repository_name = "freebayes_0010" repository_description = "Galaxy's freebayes tool" diff --git a/lib/tool_shed/test/functional/test_0020_basic_repository_dependencies.py b/lib/tool_shed/test/functional/test_0020_basic_repository_dependencies.py index f4fce544de59..31524cac120c 100644 --- a/lib/tool_shed/test/functional/test_0020_basic_repository_dependencies.py +++ b/lib/tool_shed/test/functional/test_0020_basic_repository_dependencies.py @@ -1,8 +1,6 @@ +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0020" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_0030_repository_dependency_revisions.py b/lib/tool_shed/test/functional/test_0030_repository_dependency_revisions.py index 8436d84d8794..5e873cf8f3db 100644 --- a/lib/tool_shed/test/functional/test_0030_repository_dependency_revisions.py +++ b/lib/tool_shed/test/functional/test_0030_repository_dependency_revisions.py @@ -1,8 +1,6 @@ +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0030" column_maker_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_0040_repository_circular_dependencies.py b/lib/tool_shed/test/functional/test_0040_repository_circular_dependencies.py index c1a5f0de3315..9dcb4f86c0a7 100644 --- a/lib/tool_shed/test/functional/test_0040_repository_circular_dependencies.py +++ b/lib/tool_shed/test/functional/test_0040_repository_circular_dependencies.py @@ -1,8 +1,6 @@ +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase freebayes_repository_name = "freebayes_0040" freebayes_repository_description = "Galaxy's freebayes tool for test 0040" diff --git a/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py b/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py index c774cf278cf3..95f44c2b77c0 100644 --- a/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py +++ b/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py @@ -1,8 +1,6 @@ +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase emboss_repository_name = "emboss_0050" emboss_repository_description = "Galaxy's emboss tool" diff --git a/lib/tool_shed/test/functional/test_0070_invalid_tool.py b/lib/tool_shed/test/functional/test_0070_invalid_tool.py index df577f7ea4d1..cc164c838ece 100644 --- a/lib/tool_shed/test/functional/test_0070_invalid_tool.py +++ b/lib/tool_shed/test/functional/test_0070_invalid_tool.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase repository_name = "bismark_0070" repository_description = "Galaxy's bismark wrapper" diff --git a/lib/tool_shed/test/functional/test_0080_advanced_circular_dependencies.py b/lib/tool_shed/test/functional/test_0080_advanced_circular_dependencies.py index 1d063d2e0f9d..8223284dd49c 100644 --- a/lib/tool_shed/test/functional/test_0080_advanced_circular_dependencies.py +++ b/lib/tool_shed/test/functional/test_0080_advanced_circular_dependencies.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_0080" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_0090_tool_search.py b/lib/tool_shed/test/functional/test_0090_tool_search.py index 2ceb5c982509..adea223bdb70 100644 --- a/lib/tool_shed/test/functional/test_0090_tool_search.py +++ b/lib/tool_shed/test/functional/test_0090_tool_search.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase emboss_repository_name = "emboss_0090" emboss_repository_description = "Galaxy's emboss tool" diff --git a/lib/tool_shed/test/functional/test_0100_complex_repository_dependencies.py b/lib/tool_shed/test/functional/test_0100_complex_repository_dependencies.py index fb7625860558..82d5a95f1990 100644 --- a/lib/tool_shed/test/functional/test_0100_complex_repository_dependencies.py +++ b/lib/tool_shed/test/functional/test_0100_complex_repository_dependencies.py @@ -1,11 +1,9 @@ import logging import os +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0110_invalid_simple_repository_dependencies.py b/lib/tool_shed/test/functional/test_0110_invalid_simple_repository_dependencies.py index 60b4ad2a0912..032a1ccc9f21 100644 --- a/lib/tool_shed/test/functional/test_0110_invalid_simple_repository_dependencies.py +++ b/lib/tool_shed/test/functional/test_0110_invalid_simple_repository_dependencies.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0110" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_0120_simple_repository_dependency_multiple_owners.py b/lib/tool_shed/test/functional/test_0120_simple_repository_dependency_multiple_owners.py index 71cd3322379f..86b1ba2c6aca 100644 --- a/lib/tool_shed/test/functional/test_0120_simple_repository_dependency_multiple_owners.py +++ b/lib/tool_shed/test/functional/test_0120_simple_repository_dependency_multiple_owners.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase datatypes_repository_name = "blast_datatypes_0120" datatypes_repository_description = "Galaxy applicable datatypes for BLAST" diff --git a/lib/tool_shed/test/functional/test_0140_tool_help_images.py b/lib/tool_shed/test/functional/test_0140_tool_help_images.py index 1a8247747700..42720b8d97b1 100644 --- a/lib/tool_shed/test/functional/test_0140_tool_help_images.py +++ b/lib/tool_shed/test/functional/test_0140_tool_help_images.py @@ -1,10 +1,8 @@ import logging +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0150_prior_installation_required.py b/lib/tool_shed/test/functional/test_0150_prior_installation_required.py index 22800d42c359..e87804e37ee2 100644 --- a/lib/tool_shed/test/functional/test_0150_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_0150_prior_installation_required.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_0150" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_0160_circular_prior_installation_required.py b/lib/tool_shed/test/functional/test_0160_circular_prior_installation_required.py index 5ce2a7d0f7d6..e48253aa9b0d 100644 --- a/lib/tool_shed/test/functional/test_0160_circular_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_0160_circular_prior_installation_required.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase filter_repository_name = "filtering_0160" filter_repository_description = "Galaxy's filtering tool for test 0160" diff --git a/lib/tool_shed/test/functional/test_0170_complex_prior_installation_required.py b/lib/tool_shed/test/functional/test_0170_complex_prior_installation_required.py index 7d64f6993381..0c30cc647d16 100644 --- a/lib/tool_shed/test/functional/test_0170_complex_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_0170_complex_prior_installation_required.py @@ -1,9 +1,7 @@ import os -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase matplotlib_repository_name = "package_matplotlib_1_2_0170" matplotlib_repository_description = ( diff --git a/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py b/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py index e28d653c4c41..a1817cbe62b7 100644 --- a/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py +++ b/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py @@ -1,9 +1,7 @@ from typing import Dict -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0020" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_0310_hg_api_features.py b/lib/tool_shed/test/functional/test_0310_hg_api_features.py index 589d077ef2b5..9bc20e5198d2 100644 --- a/lib/tool_shed/test/functional/test_0310_hg_api_features.py +++ b/lib/tool_shed/test/functional/test_0310_hg_api_features.py @@ -1,10 +1,8 @@ import logging import os -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py b/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py index 0a46eec3fe7b..8480013cafc4 100644 --- a/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py +++ b/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0430_browse_utilities.py b/lib/tool_shed/test/functional/test_0430_browse_utilities.py index 0202c5baf2ca..d1dfea9320b9 100644 --- a/lib/tool_shed/test/functional/test_0430_browse_utilities.py +++ b/lib/tool_shed/test/functional/test_0430_browse_utilities.py @@ -1,10 +1,8 @@ import logging +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0440_deleting_dependency_definitions.py b/lib/tool_shed/test/functional/test_0440_deleting_dependency_definitions.py index 1da5abd03751..9eb9d9b7aa94 100644 --- a/lib/tool_shed/test/functional/test_0440_deleting_dependency_definitions.py +++ b/lib/tool_shed/test/functional/test_0440_deleting_dependency_definitions.py @@ -1,8 +1,6 @@ from tool_shed_client.schema import Repository -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_0440" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_0460_upload_to_repository.py b/lib/tool_shed/test/functional/test_0460_upload_to_repository.py index d1c04840ef8e..b972c9511df1 100644 --- a/lib/tool_shed/test/functional/test_0460_upload_to_repository.py +++ b/lib/tool_shed/test/functional/test_0460_upload_to_repository.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0470_tool_dependency_repository_type.py b/lib/tool_shed/test/functional/test_0470_tool_dependency_repository_type.py index 79df2baff835..99c3fe760920 100644 --- a/lib/tool_shed/test/functional/test_0470_tool_dependency_repository_type.py +++ b/lib/tool_shed/test/functional/test_0470_tool_dependency_repository_type.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0480_tool_dependency_xml_verification.py b/lib/tool_shed/test/functional/test_0480_tool_dependency_xml_verification.py index 48f121ead36b..2fd183c8d10f 100644 --- a/lib/tool_shed/test/functional/test_0480_tool_dependency_xml_verification.py +++ b/lib/tool_shed/test/functional/test_0480_tool_dependency_xml_verification.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0530_repository_admin_feature.py b/lib/tool_shed/test/functional/test_0530_repository_admin_feature.py index 348f70281e88..2ee234496935 100644 --- a/lib/tool_shed/test/functional/test_0530_repository_admin_feature.py +++ b/lib/tool_shed/test/functional/test_0530_repository_admin_feature.py @@ -1,10 +1,8 @@ import logging +from ..base import common from ..base.api import skip_if_api_v2 -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py b/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py index 8c5b08cec3f9..073b46120003 100644 --- a/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py +++ b/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1000_install_basic_repository.py b/lib/tool_shed/test/functional/test_1000_install_basic_repository.py index 81760f008c34..b9c4ef4c0f15 100644 --- a/lib/tool_shed/test/functional/test_1000_install_basic_repository.py +++ b/lib/tool_shed/test/functional/test_1000_install_basic_repository.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase repo_name = "filtering_0000" repo_description = "Galaxy's filtering tool" diff --git a/lib/tool_shed/test/functional/test_1010_install_repository_with_tool_dependencies.py b/lib/tool_shed/test/functional/test_1010_install_repository_with_tool_dependencies.py index 976d2c354ecc..79602a643b7b 100644 --- a/lib/tool_shed/test/functional/test_1010_install_repository_with_tool_dependencies.py +++ b/lib/tool_shed/test/functional/test_1010_install_repository_with_tool_dependencies.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase repository_name = "freebayes_0010" repository_description = "Galaxy's freebayes tool" diff --git a/lib/tool_shed/test/functional/test_1020_install_repository_with_repository_dependencies.py b/lib/tool_shed/test/functional/test_1020_install_repository_with_repository_dependencies.py index b965011e7ca0..cbe394f840af 100644 --- a/lib/tool_shed/test/functional/test_1020_install_repository_with_repository_dependencies.py +++ b/lib/tool_shed/test/functional/test_1020_install_repository_with_repository_dependencies.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0020" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_1030_install_repository_with_dependency_revisions.py b/lib/tool_shed/test/functional/test_1030_install_repository_with_dependency_revisions.py index 3cc894c038cb..71a2287a4639 100644 --- a/lib/tool_shed/test/functional/test_1030_install_repository_with_dependency_revisions.py +++ b/lib/tool_shed/test/functional/test_1030_install_repository_with_dependency_revisions.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0030" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_1040_install_repository_basic_circular_dependencies.py b/lib/tool_shed/test/functional/test_1040_install_repository_basic_circular_dependencies.py index 60748c5b2763..4b40554e252c 100644 --- a/lib/tool_shed/test/functional/test_1040_install_repository_basic_circular_dependencies.py +++ b/lib/tool_shed/test/functional/test_1040_install_repository_basic_circular_dependencies.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase freebayes_repository_name = "freebayes_0040" freebayes_repository_description = "Galaxy's freebayes tool for test 0040" diff --git a/lib/tool_shed/test/functional/test_1050_circular_dependencies_4_levels.py b/lib/tool_shed/test/functional/test_1050_circular_dependencies_4_levels.py index e57633296faa..4f1f2b38d9cc 100644 --- a/lib/tool_shed/test/functional/test_1050_circular_dependencies_4_levels.py +++ b/lib/tool_shed/test/functional/test_1050_circular_dependencies_4_levels.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase emboss_repository_name = "emboss_0050" emboss_repository_description = "Galaxy's emboss tool" diff --git a/lib/tool_shed/test/functional/test_1070_invalid_tool.py b/lib/tool_shed/test/functional/test_1070_invalid_tool.py index 0f8e08e822e1..0089a94a8672 100644 --- a/lib/tool_shed/test/functional/test_1070_invalid_tool.py +++ b/lib/tool_shed/test/functional/test_1070_invalid_tool.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase repository_name = "bismark_0070" repository_description = "Galaxy's bismark wrapper" diff --git a/lib/tool_shed/test/functional/test_1080_advanced_circular_dependency_installation.py b/lib/tool_shed/test/functional/test_1080_advanced_circular_dependency_installation.py index b9f82f4c098c..fe5bd9343231 100644 --- a/lib/tool_shed/test/functional/test_1080_advanced_circular_dependency_installation.py +++ b/lib/tool_shed/test/functional/test_1080_advanced_circular_dependency_installation.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_0080" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_1090_repository_dependency_handling.py b/lib/tool_shed/test/functional/test_1090_repository_dependency_handling.py index 37192cf55b45..192a5d72eda6 100644 --- a/lib/tool_shed/test/functional/test_1090_repository_dependency_handling.py +++ b/lib/tool_shed/test/functional/test_1090_repository_dependency_handling.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_1085" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_1100_install_updated_repository_dependencies.py b/lib/tool_shed/test/functional/test_1100_install_updated_repository_dependencies.py index b824593a34d4..fa88c45a336d 100644 --- a/lib/tool_shed/test/functional/test_1100_install_updated_repository_dependencies.py +++ b/lib/tool_shed/test/functional/test_1100_install_updated_repository_dependencies.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_repository_name = "column_maker_1087" column_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py b/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py index a4c0fcf55550..37eaa6b49eef 100644 --- a/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py +++ b/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py @@ -1,9 +1,7 @@ import os -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase bwa_base_repository_name = "bwa_base_repository_0100" bwa_base_repository_description = "BWA Base" diff --git a/lib/tool_shed/test/functional/test_1130_install_repository_with_invalid_repository_dependency.py b/lib/tool_shed/test/functional/test_1130_install_repository_with_invalid_repository_dependency.py index db5139d4247d..3e66ea40253a 100644 --- a/lib/tool_shed/test/functional/test_1130_install_repository_with_invalid_repository_dependency.py +++ b/lib/tool_shed/test/functional/test_1130_install_repository_with_invalid_repository_dependency.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0110" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py b/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py index 12067ac1bce8..afe993c02af8 100644 --- a/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py +++ b/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase datatypes_repository_name = "blast_datatypes_0120" datatypes_repository_description = "Galaxy applicable datatypes for BLAST" diff --git a/lib/tool_shed/test/functional/test_1160_tool_help_images.py b/lib/tool_shed/test/functional/test_1160_tool_help_images.py index add92d62dc55..59c60906296d 100644 --- a/lib/tool_shed/test/functional/test_1160_tool_help_images.py +++ b/lib/tool_shed/test/functional/test_1160_tool_help_images.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1170_prior_installation_required.py b/lib/tool_shed/test/functional/test_1170_prior_installation_required.py index c126a29ca4b8..4d0219c25a39 100644 --- a/lib/tool_shed/test/functional/test_1170_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_1170_prior_installation_required.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1180_circular_prior_installation_required.py b/lib/tool_shed/test/functional/test_1180_circular_prior_installation_required.py index 755c823211cc..9a3cc097dbb6 100644 --- a/lib/tool_shed/test/functional/test_1180_circular_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_1180_circular_prior_installation_required.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1190_complex_prior_installation_required.py b/lib/tool_shed/test/functional/test_1190_complex_prior_installation_required.py index b4f42d7a8488..e1895100c7be 100644 --- a/lib/tool_shed/test/functional/test_1190_complex_prior_installation_required.py +++ b/lib/tool_shed/test/functional/test_1190_complex_prior_installation_required.py @@ -1,9 +1,7 @@ import os -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase matplotlib_repository_name = "package_matplotlib_1_2_0170" matplotlib_repository_description = ( diff --git a/lib/tool_shed/test/functional/test_1200_uninstall_and_reinstall_basic_repository.py b/lib/tool_shed/test/functional/test_1200_uninstall_and_reinstall_basic_repository.py index ca7d95a38507..fa14115d406a 100644 --- a/lib/tool_shed/test/functional/test_1200_uninstall_and_reinstall_basic_repository.py +++ b/lib/tool_shed/test/functional/test_1200_uninstall_and_reinstall_basic_repository.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase class TestUninstallingAndReinstallingRepositories(ShedTwillTestCase): diff --git a/lib/tool_shed/test/functional/test_1210_uninstall_reinstall_repository_with_tool_dependencies.py b/lib/tool_shed/test/functional/test_1210_uninstall_reinstall_repository_with_tool_dependencies.py index 66be32573652..e67c1b3eb98b 100644 --- a/lib/tool_shed/test/functional/test_1210_uninstall_reinstall_repository_with_tool_dependencies.py +++ b/lib/tool_shed/test/functional/test_1210_uninstall_reinstall_repository_with_tool_dependencies.py @@ -1,9 +1,7 @@ import os -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase class TestUninstallingAndReinstallingRepositories(ShedTwillTestCase): diff --git a/lib/tool_shed/test/functional/test_1230_uninstall_reinstall_repository_with_dependency_revisions.py b/lib/tool_shed/test/functional/test_1230_uninstall_reinstall_repository_with_dependency_revisions.py index 91720f67bfe1..57fe1a8a2f6e 100644 --- a/lib/tool_shed/test/functional/test_1230_uninstall_reinstall_repository_with_dependency_revisions.py +++ b/lib/tool_shed/test/functional/test_1230_uninstall_reinstall_repository_with_dependency_revisions.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0030" column_maker_repository_description = "Add column" diff --git a/lib/tool_shed/test/functional/test_1300_reset_all_metadata.py b/lib/tool_shed/test/functional/test_1300_reset_all_metadata.py index 7115bf47d02f..6e76396ab65c 100644 --- a/lib/tool_shed/test/functional/test_1300_reset_all_metadata.py +++ b/lib/tool_shed/test/functional/test_1300_reset_all_metadata.py @@ -1,7 +1,5 @@ -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase column_maker_repository_name = "column_maker_0020" column_maker_repository_description = "A flexible aligner." diff --git a/lib/tool_shed/test/functional/test_1410_update_manager.py b/lib/tool_shed/test/functional/test_1410_update_manager.py index 7debeaf57c90..6b00abf51d5d 100644 --- a/lib/tool_shed/test/functional/test_1410_update_manager.py +++ b/lib/tool_shed/test/functional/test_1410_update_manager.py @@ -1,10 +1,8 @@ import logging import time -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1430_repair_installed_repository.py b/lib/tool_shed/test/functional/test_1430_repair_installed_repository.py index 01cbdbea57e5..e1b7e6950a7a 100644 --- a/lib/tool_shed/test/functional/test_1430_repair_installed_repository.py +++ b/lib/tool_shed/test/functional/test_1430_repair_installed_repository.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1460_data_managers.py b/lib/tool_shed/test/functional/test_1460_data_managers.py index 42ad60b4ea6d..852fd891edff 100644 --- a/lib/tool_shed/test/functional/test_1460_data_managers.py +++ b/lib/tool_shed/test/functional/test_1460_data_managers.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) diff --git a/lib/tool_shed/test/functional/test_1470_updating_installed_repositories.py b/lib/tool_shed/test/functional/test_1470_updating_installed_repositories.py index fa3ac3cf55be..29de6460a400 100644 --- a/lib/tool_shed/test/functional/test_1470_updating_installed_repositories.py +++ b/lib/tool_shed/test/functional/test_1470_updating_installed_repositories.py @@ -1,9 +1,7 @@ import logging -from ..base.twilltestcase import ( - common, - ShedTwillTestCase, -) +from ..base import common +from ..base.twilltestcase import ShedTwillTestCase log = logging.getLogger(__name__) From 45b2d75b65ac67a89eddc24890f0d2011524f9c3 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 10:36:02 +0100 Subject: [PATCH 03/10] Remove unnecessary line --- .../test_1120_install_repository_with_complex_dependencies.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py b/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py index 37eaa6b49eef..3032e57bf408 100644 --- a/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py +++ b/lib/tool_shed/test/functional/test_1120_install_repository_with_complex_dependencies.py @@ -70,7 +70,6 @@ def test_0010_create_bwa_base_repository(self): category=category, strings_displayed=[], ) - self._get_repository_by_name_and_owner(bwa_package_repository_name, common.test_user_1_name) self.commit_tar_to_repository( repository, "bwa/complex/bwa_base.tar", From 9dddbca9656ebfa66eb5b750bf89edfb6f071f2e Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 10:31:48 +0100 Subject: [PATCH 04/10] Make sure `get_or_create_repository()` and `_get_repository_by_name_and_owner()` return a `Repository` --- lib/tool_shed/test/base/twilltestcase.py | 12 ++++++-- .../test_0000_basic_repository_features.py | 20 +++++++------ ..._0010_repository_with_tool_dependencies.py | 1 - ...est_0050_circular_dependencies_4_levels.py | 2 -- .../test_0300_reset_all_metadata.py | 28 ------------------- ...test_0550_metadata_updated_dependencies.py | 13 ++++----- .../functional/test_1460_data_managers.py | 1 - 7 files changed, 25 insertions(+), 52 deletions(-) diff --git a/lib/tool_shed/test/base/twilltestcase.py b/lib/tool_shed/test/base/twilltestcase.py index e7d32c23e153..e8d33a357d7c 100644 --- a/lib/tool_shed/test/base/twilltestcase.py +++ b/lib/tool_shed/test/base/twilltestcase.py @@ -905,7 +905,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 @@ -1402,7 +1406,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: @@ -1417,6 +1421,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: @@ -1495,10 +1500,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: diff --git a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py index c01c91d731ec..a5faf7b4a7f2 100644 --- a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py +++ b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py @@ -1,5 +1,7 @@ import logging +import pytest + from ..base import common from ..base.api import skip_if_api_v2 from ..base.twilltestcase import ShedTwillTestCase @@ -157,7 +159,6 @@ def test_0045_alter_repository_states(self): def test_0050_display_repository_tip_file(self): """Display the contents of filtering.xml in the repository tip revision""" repository = self._get_repository_by_name_and_owner(repository_name, common.test_user_1_name) - assert repository if self._browser.is_twill: self.display_repository_file_contents( repository=repository, @@ -268,14 +269,15 @@ def test_0095_verify_reserved_repository_name_handling(self): error_message = ( "The term 'repos' is a reserved word in the Tool Shed, so it cannot be used as a repository name." ) - self.get_or_create_repository( - name="repos", - description=repository_description, - long_description=repository_long_description, - owner=common.test_user_1_name, - category=category, - strings_displayed=[error_message], - ) + with pytest.raises(AssertionError): + self.get_or_create_repository( + name="repos", + description=repository_description, + long_description=repository_long_description, + owner=common.test_user_1_name, + category=category, + strings_displayed=[error_message], + ) def test_0100_verify_reserved_username_handling(self): """Check that reserved usernames are handled correctly.""" diff --git a/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py b/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py index 167571983521..657d73610e99 100644 --- a/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py +++ b/lib/tool_shed/test/functional/test_0010_repository_with_tool_dependencies.py @@ -51,7 +51,6 @@ def test_0010_create_freebayes_repository_and_upload_tool_xml(self): category=category, strings_displayed=[], ) - assert repository strings_displayed = ["Metadata may have been defined", "This file requires an entry", "tool_data_table_conf"] self.add_file_to_repository(repository, "freebayes/freebayes.xml", strings_displayed=strings_displayed) if self.is_v2: diff --git a/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py b/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py index 95f44c2b77c0..1075babaabe4 100644 --- a/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py +++ b/lib/tool_shed/test/functional/test_0050_circular_dependencies_4_levels.py @@ -67,8 +67,6 @@ def test_0010_create_column_repository(self): category=category, strings_displayed=[], ) - assert repository - assert repository.id self.commit_tar_to_repository( repository, "column_maker/column_maker.tar", diff --git a/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py b/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py index a1817cbe62b7..3032ccd26639 100644 --- a/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py +++ b/lib/tool_shed/test/functional/test_0300_reset_all_metadata.py @@ -63,7 +63,6 @@ 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( @@ -91,7 +90,6 @@ 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): @@ -112,7 +110,6 @@ 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", @@ -137,7 +134,6 @@ def test_0020_create_emboss_0020_repository(self): category=category_0020, strings_displayed=[], ) - assert repository self.commit_tar_to_repository( repository, "emboss/emboss.tar", @@ -162,7 +158,6 @@ 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", @@ -187,7 +182,6 @@ 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", @@ -212,7 +206,6 @@ 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", @@ -237,7 +230,6 @@ 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", @@ -251,13 +243,9 @@ 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, @@ -311,7 +299,6 @@ def test_0050_create_freebayes_repository(self): category=category_0040, strings_displayed=[], ) - assert repository if running_standalone: self.commit_tar_to_repository( repository, @@ -337,7 +324,6 @@ 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", @@ -349,9 +335,7 @@ 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, @@ -391,7 +375,6 @@ def test_0065_create_convert_repository(self): category=category, strings_displayed=[], ) - assert repository self.commit_tar_to_repository( repository, "convert_chars/convert_chars.tar", @@ -413,7 +396,6 @@ def test_0070_create_column_repository(self): category=category, strings_displayed=[], ) - assert repository self.commit_tar_to_repository( repository, "column_maker/column_maker.tar", @@ -438,7 +420,6 @@ def test_0080_create_emboss_repository(self): category=category, strings_displayed=[], ) - assert repository self.commit_tar_to_repository( repository, "emboss/emboss.tar", @@ -460,7 +441,6 @@ 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", @@ -482,7 +462,6 @@ def test_0090_create_freebayes_repository(self): category=category, strings_displayed=[], ) - assert repository self.commit_tar_to_repository( repository, "freebayes/freebayes.tar", @@ -504,7 +483,6 @@ 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): @@ -513,25 +491,19 @@ 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 diff --git a/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py b/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py index 073b46120003..fbb6c521e0eb 100644 --- a/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py +++ b/lib/tool_shed/test/functional/test_0550_metadata_updated_dependencies.py @@ -56,7 +56,7 @@ def test_0005_freebayes_repository(self): category = self.create_category(name=category_name, description=category_description) self.login(email=common.test_user_1_email, username=common.test_user_1_name) # Create a repository named package_freebayes_0550 owned by user1. - freebayes = self.get_or_create_repository( + freebayes_repository = self.get_or_create_repository( name=repositories["freebayes"]["name"], description=repositories["freebayes"]["description"], long_description=repositories["freebayes"]["long_description"], @@ -64,21 +64,20 @@ def test_0005_freebayes_repository(self): category=category, strings_displayed=[], ) - assert freebayes is not None, f"Error creating freebayes {repositories['freebayes']['name']}" self.commit_tar_to_repository( - freebayes, + freebayes_repository, "0550_files/package_freebayes_1_0550.tgz", ) if not self.is_v2: # Visit the manage repository page for package_freebayes_0_5_9_0100. self.display_manage_repository_page( - freebayes, strings_displayed=["Tool dependencies", "will not be", "to this repository"] + freebayes_repository, strings_displayed=["Tool dependencies", "will not be", "to this repository"] ) def test_0010_create_samtools_repository(self): """Create and populate the package_samtools_0550 repository.""" category = self.create_category(name=category_name, description=category_description) - samtools = self.get_or_create_repository( + samtools_repository = self.get_or_create_repository( name=repositories["samtools"]["name"], description=repositories["samtools"]["description"], long_description=repositories["samtools"]["long_description"], @@ -86,9 +85,8 @@ def test_0010_create_samtools_repository(self): category=category, strings_displayed=[], ) - assert samtools is not None, f"Error creating samtools {repositories['samtools']['name']}" self.commit_tar_to_repository( - samtools, + samtools_repository, "0550_files/package_samtools_1_0550.tgz", commit_message="Uploaded samtools 1.0.", ) @@ -104,7 +102,6 @@ def test_0015_create_filtering_repository(self): category=category, strings_displayed=[], ) - assert repository is not None, f"Error creating repository {repositories['filtering']['name']}" self.commit_tar_to_repository( repository, "0550_files/filtering_1.0.tgz", diff --git a/lib/tool_shed/test/functional/test_1460_data_managers.py b/lib/tool_shed/test/functional/test_1460_data_managers.py index 852fd891edff..b271e85c0f87 100644 --- a/lib/tool_shed/test/functional/test_1460_data_managers.py +++ b/lib/tool_shed/test/functional/test_1460_data_managers.py @@ -53,7 +53,6 @@ def test_0010_create_data_manager_repository(self): category=category, strings_displayed=[], ) - assert repository, "No repository created with name {commit_tar_to_repository}" # Upload the data manager files to the repository. self.commit_tar_to_repository( repository, From 3307161460ec8e740fba42a756837ff704d170a1 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 11:15:49 +0100 Subject: [PATCH 05/10] Fix `get_metadata()` method call 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) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- .../test/functional/test_0000_basic_repository_features.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py index a5faf7b4a7f2..02812a7b3cd6 100644 --- a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py +++ b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py @@ -303,7 +303,7 @@ def test_0110_delete_filtering_repository(self): repository = self._get_repository_by_name_and_owner(repository_name, common.test_user_1_name) self.login(email=common.admin_email, username=common.admin_username) self.delete_repository(repository) - metadata = self._populator.get_metadata(repository, downloadable_only=False) + metadata = self.populator.get_metadata(repository, downloadable_only=False) for _, value in metadata.__root__.items(): assert not value.downloadable # Explicitly reload all metadata revisions from the database, to ensure that we have the current status of the downloadable flag. From d29295e998fba1ba8e313d56cbbac2077d8ace49 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 11:57:35 +0100 Subject: [PATCH 06/10] Make sure `get_category_with_name()` returns a `Category` or raise `ValueError` --- lib/tool_shed/test/base/populators.py | 9 ++++----- lib/tool_shed/test/base/twilltestcase.py | 6 +++--- .../functional/test_0000_basic_repository_features.py | 7 ++++--- lib/tool_shed/test/functional/test_shed_categories.py | 5 +++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/tool_shed/test/base/populators.py b/lib/tool_shed/test/base/populators.py index 19b6b697b46e..7b444c5efb55 100644 --- a/lib/tool_shed/test/base/populators.py +++ b/lib/tool_shed/test/base/populators.py @@ -271,18 +271,17 @@ def get_category_with_id(self, category_id: str) -> Category: response.raise_for_status() return Category(**response.json()) - def get_category_with_name(self, name: str) -> Optional[Category]: + def get_category_with_name(self, name: str) -> Category: categories = [c for c in self.get_categories() if c.name == name] - return categories[0] if categories else None + if not categories: + raise ValueError(f"No category with name {name} found.") + return categories[0] def repositories_by_category(self, category_id: str) -> RepositoriesByCategory: response = self._api_interactor.get(f"categories/{category_id}/repositories") response.raise_for_status() return RepositoriesByCategory(**response.json()) - def has_category_with_name(self, name: str) -> bool: - return self.get_category_with_name(name) is not None - def get_ordered_installable_revisions(self, owner: str, name: str) -> OrderedInstallableRevisions: request = GetOrderedInstallableRevisionsRequest(owner=owner, name=name) revisions_response = self._api_interactor.get( diff --git a/lib/tool_shed/test/base/twilltestcase.py b/lib/tool_shed/test/base/twilltestcase.py index e8d33a357d7c..757255a9416b 100644 --- a/lib/tool_shed/test/base/twilltestcase.py +++ b/lib/tool_shed/test/base/twilltestcase.py @@ -1035,8 +1035,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 @@ -1591,7 +1592,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) diff --git a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py index 02812a7b3cd6..66e8e9816130 100644 --- a/lib/tool_shed/test/functional/test_0000_basic_repository_features.py +++ b/lib/tool_shed/test/functional/test_0000_basic_repository_features.py @@ -373,9 +373,10 @@ def test_0130_verify_handling_of_invalid_characters(self): def test_0135_api_get_repositories_in_category(self): """Load the api endpoint for repositories in a category.""" - categories = [] - categories.append(self.populator.get_category_with_name("Test 0000 Basic Repository Features 1")) - categories.append(self.populator.get_category_with_name("Test 0000 Basic Repository Features 2")) + categories = [ + self.populator.get_category_with_name(name) + for name in ("Test 0000 Basic Repository Features 1", "Test 0000 Basic Repository Features 2") + ] self.get_repositories_category_api(categories) def test_0140_view_invalid_changeset(self): diff --git a/lib/tool_shed/test/functional/test_shed_categories.py b/lib/tool_shed/test/functional/test_shed_categories.py index 3f9dd14fa516..1485617a3bdb 100644 --- a/lib/tool_shed/test/functional/test_shed_categories.py +++ b/lib/tool_shed/test/functional/test_shed_categories.py @@ -1,10 +1,12 @@ +from typing import Dict + from galaxy_test.base.api_util import random_name from ..base.api import ShedApiTestCase class TestShedCategoriesApi(ShedApiTestCase): def test_create_requires_name(self): - body = {} + body: Dict = {} response = self.admin_api_interactor.post("categories", json=body) assert response.status_code == 400 @@ -17,7 +19,6 @@ def test_create_okay(self): assert response.json()["name"] == name category = self.populator.get_category_with_name(name) - assert category is not None assert category.name == name assert category.description == description From abb6f7385b663ac32f6cbf5785c54cb41cbfd6b2 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 12:29:03 +0100 Subject: [PATCH 07/10] Fix `HostsTestToolShed` protocol 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]" ``` --- lib/tool_shed/test/base/populators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tool_shed/test/base/populators.py b/lib/tool_shed/test/base/populators.py index 7b444c5efb55..8bc6af506e08 100644 --- a/lib/tool_shed/test/base/populators.py +++ b/lib/tool_shed/test/base/populators.py @@ -79,7 +79,7 @@ def repo_tars(test_data_path: str) -> List[Path]: class HostsTestToolShed(Protocol): host: str - port: int + port: Optional[str] class ToolShedPopulator: @@ -396,7 +396,7 @@ def tool_guid( owner = repository.owner name = repository.name port = shed_host.port - if port in [None, 80, 443]: + if port in [None, "80", "443"]: host_and_port = shed_host.host else: host_and_port = f"{shed_host.host}:{shed_host.port}" From 9a356c182aa2f2d5772a0cbee6969e898f263ba1 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 12:31:58 +0100 Subject: [PATCH 08/10] Remove unneeded/wrong parameters in method calls 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[] = ...") [var-annotated] strings_not_displayed_in_iframe = [] ^ ``` --- .../functional/test_0420_citable_urls_for_repositories.py | 2 -- ...est_1140_simple_repository_dependency_multiple_owners.py | 6 ------ 2 files changed, 8 deletions(-) diff --git a/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py b/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py index 8480013cafc4..e1c06b7732b6 100644 --- a/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py +++ b/lib/tool_shed/test/functional/test_0420_citable_urls_for_repositories.py @@ -167,7 +167,6 @@ def test_0025_load_view_page_for_previous_revision(self): if not self.is_v2: strings_displayed_in_iframe.append("Link to this repository revision:") strings_displayed_in_iframe.append(f"{self.url}/view/user1/filtering_0420/{first_changeset_hash}") - strings_not_displayed_in_iframe = [] self.load_citable_url( username="user1", repository_name="filtering_0420", @@ -176,7 +175,6 @@ def test_0025_load_view_page_for_previous_revision(self): encoded_repository_id=encoded_repository_id, strings_displayed=strings_displayed, strings_displayed_in_iframe=strings_displayed_in_iframe, - strings_not_displayed_in_iframe=strings_not_displayed_in_iframe, ) def test_0030_load_sharable_url_with_invalid_changeset_revision(self): diff --git a/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py b/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py index afe993c02af8..5df13e30b2e7 100644 --- a/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py +++ b/lib/tool_shed/test/functional/test_1140_simple_repository_dependency_multiple_owners.py @@ -108,13 +108,7 @@ def test_0015_create_tool_repository(self): self.commit_tar_to_repository( repository, "blast/blastxml_to_top_descr.tar", - filepath=None, - valid_tools_only=True, - uncompress_file=True, - remove_repo_files_not_in_tar=True, commit_message="Uploaded blastxml_to_top_descr tarball.", - strings_displayed=[], - strings_not_displayed=[], ) def test_0020_verify_tool_repository(self): From e59c188c1936d779c51fd7f8891425ef236a0f38 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 12:45:36 +0100 Subject: [PATCH 09/10] Fix mypy assignment error 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() ^ ``` --- lib/tool_shed/test/functional/test_shed_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tool_shed/test/functional/test_shed_tools.py b/lib/tool_shed/test/functional/test_shed_tools.py index 8d91ce088b73..c54dd825e479 100644 --- a/lib/tool_shed/test/functional/test_shed_tools.py +++ b/lib/tool_shed/test/functional/test_shed_tools.py @@ -27,8 +27,8 @@ def test_tool_search(self): assert tool_search_hit.tool.name == "Compute" # ensure re-index doesn't modify number of hits (regression of an issue pre-Fall 2022) - response = populator.reindex() - response = populator.reindex() + populator.reindex() + populator.reindex() response = populator.tool_search_query("Compute") new_hit_count = len(response.hits) From 256a81f01fa978bac30cbe7b2a5624518bfc8de1 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 24 Oct 2023 13:04:28 +0100 Subject: [PATCH 10/10] Change default for `redirect` param of `create()` and `login()` to None 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) ^ ``` --- lib/tool_shed/test/base/twilltestcase.py | 12 ++++++++++-- lib/tool_shed/test/functional/test_frontend_login.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/tool_shed/test/base/twilltestcase.py b/lib/tool_shed/test/base/twilltestcase.py index 757255a9416b..937b41d262ca 100644 --- a/lib/tool_shed/test/base/twilltestcase.py +++ b/lib/tool_shed/test/base/twilltestcase.py @@ -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="test@bx.psu.edu", password="testuser", username="admin-user", redirect=""): + def create( + self, + cntrller: str = "user", + email: str = "test@bx.psu.edu", + 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 = "test@bx.psu.edu", password: str = "testuser", username: str = "admin-user", - redirect: str = "", + redirect: Optional[str] = None, logout_first: bool = True, ): if self.is_v2: diff --git a/lib/tool_shed/test/functional/test_frontend_login.py b/lib/tool_shed/test/functional/test_frontend_login.py index 1e752c37e934..f359cf97ae41 100644 --- a/lib/tool_shed/test/functional/test_frontend_login.py +++ b/lib/tool_shed/test/functional/test_frontend_login.py @@ -73,4 +73,4 @@ def _create_and_login(self): password=TEST_PASSWORD, username=user, ) - self.login(email, TEST_PASSWORD, username=user, redirect=None) + self.login(email, TEST_PASSWORD, username=user)