Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- chore(deps): update mcr.microsoft.com/devcontainers/miniconda docker digest to 19516ba ([#3890](https://github.com/nf-core/tools/pull/3890))
- Update dependency textual to v6.6.0 ([#3892](https://github.com/nf-core/tools/pull/3892))
- chore(deps): update mcr.microsoft.com/devcontainers/base:debian docker digest to 2e826a6 ([#3893](https://github.com/nf-core/tools/pull/3893))
- Fix GH API rate limits. ([#3895](https://github.com/nf-core/tools/pull/3895))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.14.5 ([#3900](https://github.com/nf-core/tools/pull/3900))

### Template
Expand Down
15 changes: 13 additions & 2 deletions tests/test_datasets/test_test_datasets_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

import requests
Expand Down Expand Up @@ -92,7 +93,7 @@ def test_modules_branch_name_changed(self):

def test_modules_branch_exists(self):
url = self.gh_urls.get_remote_tree_url_for_branch(MODULES_BRANCH_NAME)
resp = requests.get(url)
resp = self._request_with_token(url)
self.assertTrue(resp.ok)
self.assertTrue(len(resp.json()) != 0)

Expand Down Expand Up @@ -143,9 +144,19 @@ def test_github_endpoints(self):
self.assertTrue(url_2 is not None)
self.assertTrue(url_3 is not None)

resp_1 = requests.get(url_1)
resp_1 = self._request_with_token(url_1)
resp_2 = requests.get(url_2)
resp_3 = requests.get(url_3)
self.assertTrue(resp_1.ok)
self.assertTrue(resp_2.ok)
self.assertFalse(resp_3.ok)

def _request_with_token(self, url):
"""Make a request with a GitHub token if available to mitigate issues with API rate limits."""
headers = {}
github_token = os.environ.get("GITHUB_TOKEN")
if github_token:
headers["authorization"] = f"Bearer {github_token}"

resp = requests.get(url, headers=headers)
return resp