Skip to content
/ ape Public
forked from ApeWorX/ape

Commit e9d5935

Browse files
authored
fix: remove unneeded github auth check when displaying available plugins (#287)
1 parent 930c83c commit e9d5935

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ pre-commit install
3232

3333
Committing will now automatically run the local hooks and ensure that your commit passes all lint checks.
3434

35+
## Github Access Token
36+
37+
If you are a member of ApeWorX and would like to install private plugins,
38+
[create a Github access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).
39+
40+
Once you have your token, export it to your terminal session:
41+
42+
```bash
43+
export GITHUB_ACCESS_TOKEN=<your-token>
44+
```
45+
3546
## Pull Requests
3647

3748
Pull requests are welcomed! Please adhere to the following:

src/ape/utils.py

-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,6 @@ def ape_org(self):
212212

213213
@cached_property
214214
def available_plugins(self) -> Set[str]:
215-
if not self.has_auth:
216-
logger.warning(f"${self.TOKEN_KEY} not set, unable to list all plugins.")
217-
return set()
218-
219215
return {
220216
repo.name.replace("-", "_")
221217
for repo in self.ape_org.get_repos()

tests/integration/cli/test_misc.py

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import pytest
2+
from github import RateLimitExceededException
3+
4+
from .utils import skip_projects_except
25

36

47
# NOTE: test all the things without a direct test elsewhere
@@ -13,10 +16,31 @@
1316
["networks"],
1417
["networks", "list"],
1518
["plugins"],
16-
["plugins", "list"],
17-
["plugins", "list", "--all"],
1819
),
1920
)
2021
def test_invocation(ape_cli, runner, args):
2122
result = runner.invoke(ape_cli, args)
2223
assert result.exit_code == 0
24+
25+
26+
# Only run these tests once (limited to single arbitrary project).
27+
# This is to prevent Github from rate limiting us and causing test failures.
28+
@skip_projects_except(["empty-config"])
29+
@pytest.mark.parametrize(
30+
"args",
31+
(
32+
["plugins", "list"],
33+
["plugins", "list", "--all"],
34+
),
35+
)
36+
def test_invocation_run_once(ape_cli, runner, args):
37+
result = runner.invoke(ape_cli, args)
38+
39+
if result.exit_code != 0:
40+
# Check if failed because we were rate-limited.
41+
# If that is the case, consider the test as passing.
42+
err = result.exception
43+
if not isinstance(err, RateLimitExceededException):
44+
assert False, result.output
45+
46+
# Test Passed

0 commit comments

Comments
 (0)