diff --git a/docs/BUILD b/docs/BUILD index db46e8d6c978c67e301dd6c47bee08c1b3fd141c..589a3826065572eb43f4b32057eb865b39d65aa5 100644 --- a/docs/BUILD +++ b/docs/BUILD @@ -1 +1,9 @@ python_sources() + +poetry_requirements( + name="poetry", +) + +python_requirements( + name="reqs", +) diff --git a/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py b/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py index 86cb7f61ddb4adff67eac049f7a2ee39474bd26b..1d8057beb316d2e41f0046b45ec0335edd455fb9 100644 --- a/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py +++ b/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py @@ -11,6 +11,7 @@ from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Protocol from dataclasses_json import DataClassJsonMixin, config +from httpx import HTTPError @dataclass @@ -221,6 +222,7 @@ class GithubClient: base_url: str = DEFAULT_BASE_URL, api_version: str = DEFAULT_API_VERSION, verbose: bool = False, + fail_on_http_error: bool = True, ) -> None: """ Initialize the GithubClient. @@ -232,6 +234,8 @@ class GithubClient: - base_url (str): Base URL for the Github API (defaults to "https://api.github.com"). - api_version (str): Github API version (defaults to "2022-11-28"). + - verbose (bool): Whether to print verbose output (defaults to False). + - fail_on_http_error (bool): Whether to raise an exception on HTTP errors (defaults to True). Raises: ValueError: If no Github token is provided. @@ -248,6 +252,7 @@ class GithubClient: self._base_url = base_url self._api_version = api_version self._verbose = verbose + self._fail_on_http_error = fail_on_http_error self._endpoints = { "getTree": "/repos/{owner}/{repo}/git/trees/{tree_sha}", @@ -294,7 +299,7 @@ class GithubClient: Raises: - ImportError: If the `httpx` library is not installed. - - httpx.HTTPError: If the API request fails. + - httpx.HTTPError: If the API request fails and fail_on_http_error is True. Examples: >>> response = client.request("getTree", "GET", @@ -451,6 +456,12 @@ class GithubClient: except KeyError: print(f"Failed to get blob for {owner}/{repo}/{file_sha}") return None + except HTTPError as excp: + print(f"HTTP Exception for {excp.request.url} - {excp}") + if self._fail_on_http_error: + raise + else: + return None async def get_commit( self, diff --git a/llama-index-integrations/readers/llama-index-readers-github/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-github/pyproject.toml index 29f6933598035fc4d6e8348013dafcc747bc32d7..176cdb002d50f508cf558a869eca6ac4e111ca38 100644 --- a/llama-index-integrations/readers/llama-index-readers-github/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-github/pyproject.toml @@ -31,7 +31,7 @@ license = "MIT" maintainers = ["ahmetkca", "moncho", "rwood-97"] name = "llama-index-readers-github" readme = "README.md" -version = "0.1.8" +version = "0.1.9" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" diff --git a/llama-index-integrations/readers/llama-index-readers-github/tests/BUILD b/llama-index-integrations/readers/llama-index-readers-github/tests/BUILD new file mode 100644 index 0000000000000000000000000000000000000000..de1e1004dbd49b26b9fe59b69cfeae068b7cfd78 --- /dev/null +++ b/llama-index-integrations/readers/llama-index-readers-github/tests/BUILD @@ -0,0 +1,3 @@ +python_tests( + dependencies=['llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file'] +) diff --git a/llama-index-integrations/readers/llama-index-readers-github/tests/test_github_repository_reader.py b/llama-index-integrations/readers/llama-index-readers-github/tests/test_github_repository_reader.py new file mode 100644 index 0000000000000000000000000000000000000000..c634338f5ed5e8096a169545b500b0d289d49012 --- /dev/null +++ b/llama-index-integrations/readers/llama-index-readers-github/tests/test_github_repository_reader.py @@ -0,0 +1,75 @@ +from __future__ import annotations + +from llama_index.readers.github import GithubRepositoryReader +from llama_index.readers.github.repository.github_client import ( + GithubClient, + GitBranchResponseModel, + GitTreeResponseModel, + GitCommitResponseModel, +) +from llama_index.core.schema import Document +import os +import pytest +from httpx import HTTPError + +COMMIT_JSON = '{"sha":"a11a953e738cbda93335ede83f012914d53dc4f7","node_id":"C_kwDOIWuq59oAKGExMWE5NTNlNzM4Y2JkYTkzMzM1ZWRlODNmMDEyOTE0ZDUzZGM0Zjc","commit":{"author":{"name":"Grisha","email":"skvrd@users.noreply.github.com","date":"2024-05-08T15:19:34Z"},"committer":{"name":"GitHub","email":"noreply@github.com","date":"2024-05-08T15:19:34Z"},"message":"Fix hidden temp directory issue for arxiv reader (#13351)\\n\\n* Fix hidden temp directory issue for arxiv reader\\r\\n\\r\\n* add comment base.py\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Andrei Fajardo <92402603+nerdai@users.noreply.github.com>","tree":{"sha":"01d1b2024af28c7d5abf2a66108e7ed5611c6308","url":"https://api.github.com/repos/run-llama/llama_index/git/trees/01d1b2024af28c7d5abf2a66108e7ed5611c6308"},"url":"https://api.github.com/repos/run-llama/llama_index/git/commits/a11a953e738cbda93335ede83f012914d53dc4f7","comment_count":0,"verification":{"verified":true,"reason":"valid","signature":"-----BEGIN PGP SIGNATURE-----\\n\\nwsFcBAABCAAQBQJmO5gGCRC1aQ7uu5UhlAAAjoYQAEy/6iaWXaHQUEAz2w+2fs7C\\n8cXt3BcXkbO+d6WmIsca22wCbhRVj0TQdYTbfjLDpyMK1BdFcsgBjC7Ym8dm40dZ\\nRxoNd0Ws04doz64L67zXtBTQXjEb3nNnDkl82jk0AtuFfb69pTjC/rH/MqDt7v4F\\nU4uDR0OyDakmEEFNE63UhKmbwkmMN33VXZMbm2obxJklR2rBCge7EBhtj+iwD8Og\\nDQ852VzB7/PV4mhalLjuP8CiY9kItZq0zN+Fn/ghB+0o6Xf3cIxCraiL34jxGBma\\nvXgRsqgI8kMW5ZE9zRjQhEh5GFYEiisjvcwmrJrZsFxzOcWseEb78BAue1uMqEEK\\nBgvQMO7jAoRX328Eig3kj0TCs+MHaI1YHa4ZXDBua5ocE0O+ryNA/qS5eNWBKDqA\\n/v1TUdGbXjW6ObAK6XAnSt60hweLrd7s03UCvhadwbdvm7oduP7btMbYvzMqwWem\\ns/iCaYluwoKQS6pV5aFOkRU/CY8fecs9eXVsawEDfLLIKPjJGbxW8NR2YY898a0k\\nWC2s6hcqb61wAAy/Bnu0MIvkVTGtuTEu484zC5n7HcNUmZXcsdL/SHpb/IrWiLbr\\nxGGpeQbgol7Yry88Ntg7hzT+15jf+GCS0kKu5yx4i5omM21w+Y1byc7qJuIvXDai\\nbAepk3FlF/OSy2rfYoi6\\n=5Hcu\\n-----END PGP SIGNATURE-----\\n","payload":"tree 01d1b2024af28c7d5abf2a66108e7ed5611c6308\\nparent d089b78198add300ea06b8c874234fc2c6d8f172\\nauthor Grisha <skvrd@users.noreply.github.com> 1715181574 -0700\\ncommitter GitHub <noreply@github.com> 1715181574 +0000\\n\\nFix hidden temp directory issue for arxiv reader (#13351)\\n\\n* Fix hidden temp directory issue for arxiv reader\\r\\n\\r\\n* add comment base.py\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Andrei Fajardo <92402603+nerdai@users.noreply.github.com>"}},"url":"https://api.github.com/repos/run-llama/llama_index/commits/a11a953e738cbda93335ede83f012914d53dc4f7","html_url":"https://github.com/run-llama/llama_index/commit/a11a953e738cbda93335ede83f012914d53dc4f7","comments_url":"https://api.github.com/repos/run-llama/llama_index/commits/a11a953e738cbda93335ede83f012914d53dc4f7/comments","author":{"login":"skvrd","id":18094327,"node_id":"MDQ6VXNlcjE4MDk0MzI3","avatar_url":"https://avatars.githubusercontent.com/u/18094327?v=4","gravatar_id":"","url":"https://api.github.com/users/skvrd","html_url":"https://github.com/skvrd","followers_url":"https://api.github.com/users/skvrd/followers","following_url":"https://api.github.com/users/skvrd/following{/other_user}","gists_url":"https://api.github.com/users/skvrd/gists{/gist_id}","starred_url":"https://api.github.com/users/skvrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skvrd/subscriptions","organizations_url":"https://api.github.com/users/skvrd/orgs","repos_url":"https://api.github.com/users/skvrd/repos","events_url":"https://api.github.com/users/skvrd/events{/privacy}","received_events_url":"https://api.github.com/users/skvrd/received_events","type":"User","site_admin":false},"committer":{"login":"web-flow","id":19864447,"node_id":"MDQ6VXNlcjE5ODY0NDQ3","avatar_url":"https://avatars.githubusercontent.com/u/19864447?v=4","gravatar_id":"","url":"https://api.github.com/users/web-flow","html_url":"https://github.com/web-flow","followers_url":"https://api.github.com/users/web-flow/followers","following_url":"https://api.github.com/users/web-flow/following{/other_user}","gists_url":"https://api.github.com/users/web-flow/gists{/gist_id}","starred_url":"https://api.github.com/users/web-flow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web-flow/subscriptions","organizations_url":"https://api.github.com/users/web-flow/orgs","repos_url":"https://api.github.com/users/web-flow/repos","events_url":"https://api.github.com/users/web-flow/events{/privacy}","received_events_url":"https://api.github.com/users/web-flow/received_events","type":"User","site_admin":false},"parents":[{"sha":"d089b78198add300ea06b8c874234fc2c6d8f172","url":"https://api.github.com/repos/run-llama/llama_index/commits/d089b78198add300ea06b8c874234fc2c6d8f172","html_url":"https://github.com/run-llama/llama_index/commit/d089b78198add300ea06b8c874234fc2c6d8f172"}],"stats":{"total":12,"additions":10,"deletions":2},"files":[{"sha":"b3813e3c4c6cd8c90fb9ec0409c2d7ce6ca38304","filename":"llama-index-integrations/readers/llama-index-readers-papers/CHANGELOG.md","status":"modified","additions":6,"deletions":0,"changes":6,"blob_url":"https://github.com/run-llama/llama_index/blob/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2FCHANGELOG.md","raw_url":"https://github.com/run-llama/llama_index/raw/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2FCHANGELOG.md","contents_url":"https://api.github.com/repos/run-llama/llama_index/contents/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2FCHANGELOG.md?ref=a11a953e738cbda93335ede83f012914d53dc4f7","patch":"@@ -1,5 +1,11 @@\\n # CHANGELOG\\n \\n+## [0.1.5] - 2024-05-07\\n+\\n+### Bug Fixes\\n+\\n+- Fix issues with hidden temporary folder (#13165)\\n+\\n ## [0.1.2] - 2024-02-13\\n \\n - Add maintainers and keywords from library.json (llamahub)"},{"sha":"6519b4e78e6890dc71ecc8140876418bde453309","filename":"llama-index-integrations/readers/llama-index-readers-papers/llama_index/readers/papers/arxiv/base.py","status":"modified","additions":3,"deletions":1,"changes":4,"blob_url":"https://github.com/run-llama/llama_index/blob/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fllama_index%2Freaders%2Fpapers%2Farxiv%2Fbase.py","raw_url":"https://github.com/run-llama/llama_index/raw/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fllama_index%2Freaders%2Fpapers%2Farxiv%2Fbase.py","contents_url":"https://api.github.com/repos/run-llama/llama_index/contents/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fllama_index%2Freaders%2Fpapers%2Farxiv%2Fbase.py?ref=a11a953e738cbda93335ede83f012914d53dc4f7","patch":"@@ -73,7 +73,9 @@ def get_paper_metadata(filename):\\n return paper_lookup[os.path.basename(filename)]\\n \\n arxiv_documents = SimpleDirectoryReader(\\n- papers_dir, file_metadata=get_paper_metadata\\n+ papers_dir,\\n+ file_metadata=get_paper_metadata,\\n+ exclude_hidden=False, # default directory is hidden \\".papers\\"\\n ).load_data()\\n # Include extra documents containing the abstracts\\n abstract_documents = []"},{"sha":"0cb2c74567e189cf481ad1e7ffe81e1020174edd","filename":"llama-index-integrations/readers/llama-index-readers-papers/pyproject.toml","status":"modified","additions":1,"deletions":1,"changes":2,"blob_url":"https://github.com/run-llama/llama_index/blob/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fpyproject.toml","raw_url":"https://github.com/run-llama/llama_index/raw/a11a953e738cbda93335ede83f012914d53dc4f7/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fpyproject.toml","contents_url":"https://api.github.com/repos/run-llama/llama_index/contents/llama-index-integrations%2Freaders%2Fllama-index-readers-papers%2Fpyproject.toml?ref=a11a953e738cbda93335ede83f012914d53dc4f7","patch":"@@ -29,7 +29,7 @@ license = \\"MIT\\"\\n maintainers = [\\"thejessezhang\\"]\\n name = \\"llama-index-readers-papers\\"\\n readme = \\"README.md\\"\\n-version = \\"0.1.4\\"\\n+version = \\"0.1.5\\"\\n \\n [tool.poetry.dependencies]\\n python = \\">=3.8.1,<4.0\\""}]}' + +BRANCH_JSON = '{"name":"main","commit":{"sha":"a11a953e738cbda93335ede83f012914d53dc4f7","node_id":"C_kwDOIWuq59oAKGExMWE5NTNlNzM4Y2JkYTkzMzM1ZWRlODNmMDEyOTE0ZDUzZGM0Zjc","commit":{"author":{"name":"Grisha","email":"skvrd@users.noreply.github.com","date":"2024-05-08T15:19:34Z"},"committer":{"name":"GitHub","email":"noreply@github.com","date":"2024-05-08T15:19:34Z"},"message":"Fix hidden temp directory issue for arxiv reader (#13351)\\n\\n* Fix hidden temp directory issue for arxiv reader\\r\\n\\r\\n* add comment base.py\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Andrei Fajardo <92402603+nerdai@users.noreply.github.com>","tree":{"sha":"01d1b2024af28c7d5abf2a66108e7ed5611c6308","url":"https://api.github.com/repos/run-llama/llama_index/git/trees/01d1b2024af28c7d5abf2a66108e7ed5611c6308"},"url":"https://api.github.com/repos/run-llama/llama_index/git/commits/a11a953e738cbda93335ede83f012914d53dc4f7","comment_count":0,"verification":{"verified":true,"reason":"valid","signature":"-----BEGIN PGP SIGNATURE-----\\n\\nwsFcBAABCAAQBQJmO5gGCRC1aQ7uu5UhlAAAjoYQAEy/6iaWXaHQUEAz2w+2fs7C\\n8cXt3BcXkbO+d6WmIsca22wCbhRVj0TQdYTbfjLDpyMK1BdFcsgBjC7Ym8dm40dZ\\nRxoNd0Ws04doz64L67zXtBTQXjEb3nNnDkl82jk0AtuFfb69pTjC/rH/MqDt7v4F\\nU4uDR0OyDakmEEFNE63UhKmbwkmMN33VXZMbm2obxJklR2rBCge7EBhtj+iwD8Og\\nDQ852VzB7/PV4mhalLjuP8CiY9kItZq0zN+Fn/ghB+0o6Xf3cIxCraiL34jxGBma\\nvXgRsqgI8kMW5ZE9zRjQhEh5GFYEiisjvcwmrJrZsFxzOcWseEb78BAue1uMqEEK\\nBgvQMO7jAoRX328Eig3kj0TCs+MHaI1YHa4ZXDBua5ocE0O+ryNA/qS5eNWBKDqA\\n/v1TUdGbXjW6ObAK6XAnSt60hweLrd7s03UCvhadwbdvm7oduP7btMbYvzMqwWem\\ns/iCaYluwoKQS6pV5aFOkRU/CY8fecs9eXVsawEDfLLIKPjJGbxW8NR2YY898a0k\\nWC2s6hcqb61wAAy/Bnu0MIvkVTGtuTEu484zC5n7HcNUmZXcsdL/SHpb/IrWiLbr\\nxGGpeQbgol7Yry88Ntg7hzT+15jf+GCS0kKu5yx4i5omM21w+Y1byc7qJuIvXDai\\nbAepk3FlF/OSy2rfYoi6\\n=5Hcu\\n-----END PGP SIGNATURE-----\\n","payload":"tree 01d1b2024af28c7d5abf2a66108e7ed5611c6308\\nparent d089b78198add300ea06b8c874234fc2c6d8f172\\nauthor Grisha <skvrd@users.noreply.github.com> 1715181574 -0700\\ncommitter GitHub <noreply@github.com> 1715181574 +0000\\n\\nFix hidden temp directory issue for arxiv reader (#13351)\\n\\n* Fix hidden temp directory issue for arxiv reader\\r\\n\\r\\n* add comment base.py\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Andrei Fajardo <92402603+nerdai@users.noreply.github.com>"}},"url":"https://api.github.com/repos/run-llama/llama_index/commits/a11a953e738cbda93335ede83f012914d53dc4f7","html_url":"https://github.com/run-llama/llama_index/commit/a11a953e738cbda93335ede83f012914d53dc4f7","comments_url":"https://api.github.com/repos/run-llama/llama_index/commits/a11a953e738cbda93335ede83f012914d53dc4f7/comments","author":{"login":"skvrd","id":18094327,"node_id":"MDQ6VXNlcjE4MDk0MzI3","avatar_url":"https://avatars.githubusercontent.com/u/18094327?v=4","gravatar_id":"","url":"https://api.github.com/users/skvrd","html_url":"https://github.com/skvrd","followers_url":"https://api.github.com/users/skvrd/followers","following_url":"https://api.github.com/users/skvrd/following{/other_user}","gists_url":"https://api.github.com/users/skvrd/gists{/gist_id}","starred_url":"https://api.github.com/users/skvrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skvrd/subscriptions","organizations_url":"https://api.github.com/users/skvrd/orgs","repos_url":"https://api.github.com/users/skvrd/repos","events_url":"https://api.github.com/users/skvrd/events{/privacy}","received_events_url":"https://api.github.com/users/skvrd/received_events","type":"User","site_admin":false},"committer":{"login":"web-flow","id":19864447,"node_id":"MDQ6VXNlcjE5ODY0NDQ3","avatar_url":"https://avatars.githubusercontent.com/u/19864447?v=4","gravatar_id":"","url":"https://api.github.com/users/web-flow","html_url":"https://github.com/web-flow","followers_url":"https://api.github.com/users/web-flow/followers","following_url":"https://api.github.com/users/web-flow/following{/other_user}","gists_url":"https://api.github.com/users/web-flow/gists{/gist_id}","starred_url":"https://api.github.com/users/web-flow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web-flow/subscriptions","organizations_url":"https://api.github.com/users/web-flow/orgs","repos_url":"https://api.github.com/users/web-flow/repos","events_url":"https://api.github.com/users/web-flow/events{/privacy}","received_events_url":"https://api.github.com/users/web-flow/received_events","type":"User","site_admin":false},"parents":[{"sha":"d089b78198add300ea06b8c874234fc2c6d8f172","url":"https://api.github.com/repos/run-llama/llama_index/commits/d089b78198add300ea06b8c874234fc2c6d8f172","html_url":"https://github.com/run-llama/llama_index/commit/d089b78198add300ea06b8c874234fc2c6d8f172"}]},"_links":{"self":"https://api.github.com/repos/run-llama/llama_index/branches/main","html":"https://github.com/run-llama/llama_index/tree/main"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"non_admins","contexts":["CodeQL","build (3.9)","build (ubuntu-latest, 3.9)","build (windows-latest, 3.9)","test (3.8)","test (3.9)","test (3.10)"],"checks":[{"context":"CodeQL","app_id":57789},{"context":"build (3.9)","app_id":15368},{"context":"build (ubuntu-latest, 3.9)","app_id":15368},{"context":"build (windows-latest, 3.9)","app_id":15368},{"context":"test (3.8)","app_id":15368},{"context":"test (3.9)","app_id":15368},{"context":"test (3.10)","app_id":15368}]}},"protection_url":"https://api.github.com/repos/run-llama/llama_index/branches/main/protection"}' + +TREE_JSON = '{"sha":"01d1b2024af28c7d5abf2a66108e7ed5611c6308","url":"https://api.github.com/repos/run-llama/llama_index/git/trees/01d1b2024af28c7d5abf2a66108e7ed5611c6308","tree":[{"path":"README.md","mode":"100644","type":"blob","sha":"0bbd4e1720494e30e267c11dc9967c100b86bad8","size":10101,"url":"https://api.github.com/repos/run-llama/llama_index/git/blobs/0bbd4e1720494e30e267c11dc9967c100b86bad8"}],"truncated":false}' + +github_token = os.environ.get("GITHUB_TOKEN", None) + + +@pytest.fixture() +def mock_error(monkeypatch): + async def mock_get_blob(self, *args, **kwargs): + if self._fail_on_http_error: + raise HTTPError("Woops") + else: + return + + monkeypatch.setattr(GithubClient, "get_blob", mock_get_blob) + + async def mock_get_commit(self, *args, **kwargs): + return GitCommitResponseModel.from_json(COMMIT_JSON) + + monkeypatch.setattr(GithubClient, "get_commit", mock_get_commit) + + async def mock_get_branch(self, *args, **kwargs): + return GitBranchResponseModel.from_json(BRANCH_JSON) + + monkeypatch.setattr(GithubClient, "get_branch", mock_get_branch) + + async def mock_get_tree(self, *args, **kwargs): + return GitTreeResponseModel.from_json(TREE_JSON) + + monkeypatch.setattr(GithubClient, "get_tree", mock_get_tree) + + +@pytest.mark.skipif(not github_token, reason="No github token") +def test_fail_on_http_error_true(mock_error): + token = os.getenv("GITHUB_TOKEN") + gh_client = GithubClient(token, fail_on_http_error=True) + reader = GithubRepositoryReader(gh_client, "run-llama", "llama_index") + # test for branch + with pytest.raises(HTTPError): + reader.load_data(branch="main") + # test for commit + with pytest.raises(HTTPError): + reader.load_data(commit_sha="a11a953e738cbda93335ede83f012914d53dc4f7") + + +@pytest.mark.skipif(not github_token, reason="No github token") +def test_fail_on_http_error_false(mock_error): + token = os.getenv("GITHUB_TOKEN") + gh_client = GithubClient(token, fail_on_http_error=False) + reader = GithubRepositoryReader(gh_client, "run-llama", "llama_index") + # test for branch + documents = reader.load_data(branch="main") + assert isinstance(documents, list) + assert all(isinstance(doc, Document) for doc in documents) + # test for commit + documents = reader.load_data(commit_sha="a11a953e738cbda93335ede83f012914d53dc4f7") + assert isinstance(documents, list) + assert all(isinstance(doc, Document) for doc in documents)