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: ape plugins list failed when no plugins installed. [APE-1425] #1683

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/ape/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ def add_padding_to_strings(
List[str]: A list of equal-length strings with padded spaces.
"""

if not str_list:
return []

longest_item = len(max(str_list, key=len))
spaced_items = []

Expand Down
8 changes: 5 additions & 3 deletions tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ def test_get_project_without_contracts_path(project):


def test_get_project_with_contracts_path(project):
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder"
project = project.get_project(project_path, project_path / "sources")
assert project.contracts_folder == project_path / "sources"
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder_specified_in_config"
project = project.get_project(project_path, project_path / "my_contracts")
assert project.contracts_folder == project_path / "my_contracts"


def test_get_project_figure_out_contracts_path(project):
Expand All @@ -351,6 +351,8 @@ def test_get_project_figure_out_contracts_path(project):
to figure it out.
"""
project_path = WITH_DEPS_PROJECT / "renamed_contracts_folder"
(project_path / "ape-config.yaml").unlink(missing_ok=True) # Clean from prior.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hoping this addresses an intermittent failure i can not explain....


project = project.get_project(project_path)
assert project.contracts_folder == project_path / "sources"

Expand Down
7 changes: 6 additions & 1 deletion tests/functional/utils/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ def test_extract_nested_value_non_dict_in_middle_returns_none():
assert not extract_nested_value(structure, "foo", "non_dict", "test")


def test_add_spacing_to_strings():
def test_add_padding_to_strings():
string_list = ["foo", "address", "ethereum"]
expected = ["foo ", "address ", "ethereum "]
actual = add_padding_to_strings(string_list, extra_spaces=4)
assert actual == expected


def test_add_padding_to_strings_empty_list():
actual = add_padding_to_strings([])
assert actual == []


def test_raises_not_implemented():
@raises_not_implemented
def unimplemented_api_method():
Expand Down
Loading