Skip to content

Commit

Permalink
fix: ape plugins list showed core plugins when it was not supposed to (
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjagod1251 authored Mar 25, 2022
1 parent c9ffc88 commit 967f3cd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: [3.7, 3.8, 3.9, "3.10"]

env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

Expand Down
6 changes: 1 addition & 5 deletions src/ape/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,7 @@ class GithubClient:
_repo_cache: Dict[str, GithubRepository] = {}

def __init__(self):
token = None
self.has_auth = self.TOKEN_KEY in os.environ
if self.has_auth:
token = os.environ[self.TOKEN_KEY]

token = os.environ[self.TOKEN_KEY] if self.TOKEN_KEY in os.environ else None
self._client = Github(login_or_token=token, user_agent=USER_AGENT)

@cached_property
Expand Down
2 changes: 0 additions & 2 deletions src/ape_plugins/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def _list(cli_ctx, display_all):

for name in spaced_names:
plugin = ApePlugin(name)

if plugin.is_part_of_core:
if not display_all:
continue
Expand All @@ -126,7 +125,6 @@ def _list(cli_ctx, display_all):
installed_plugin_lists = [
ls for ls in [installed_org_plugins, installed_third_party_plugins] if ls
]

if installed_plugin_lists:
sections["Installed Plugins"] = installed_plugin_lists
elif not display_all and available_plugins:
Expand Down
2 changes: 1 addition & 1 deletion src/ape_plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def can_install(self) -> bool:

@property
def is_part_of_core(self) -> bool:
return self.module_name in CORE_PLUGINS
return self.module_name.strip() in CORE_PLUGINS

@property
def is_installed(self) -> bool:
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/cli/test_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

from tests.integration.cli.utils import skip_projects_except


@pytest.mark.xfail(strict=False, reason="Github rate limiting issues")
@skip_projects_except(["test"]) # Only run on single project to prevent rate-limiting in CI/CD
def test_list_excludes_core_plugins(ape_cli, runner):
result = runner.invoke(ape_cli, ["plugins", "list"])
assert result.exit_code == 0, result.output
assert "console" not in result.output, "console is not supposed to be in Installed Plugins"
assert "networks" not in result.output, "networks is not supposed to be in Installed Plugins"
assert "geth" not in result.output, "networks is not supposed to be in Installed Plugins"

0 comments on commit 967f3cd

Please sign in to comment.