Skip to content

Commit 79764ba

Browse files
committed
tests: use github token in docstring tests
1 parent 5e40618 commit 79764ba

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
3434
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3535
AWS_REGION: "us-east-1"
36+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3637

3738
test-rsconnect:
3839
name: "Test RSConnect"
@@ -53,6 +54,7 @@ jobs:
5354
make dev
5455
env:
5556
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
57+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
5658

5759
# NOTE: edited to run checks for python package
5860
- name: Run tests

pins/boards.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,13 @@ class BoardManual(BaseBoard):
568568
Examples
569569
--------
570570
>>> import fsspec
571-
>>> fs = fsspec.filesystem("github", org = "machow", repo = "pins-python")
571+
>>> import os
572+
>>> fs = fsspec.filesystem(
573+
... "github",
574+
... org = "machow",
575+
... repo = "pins-python",
576+
... token=os.environ.get("GITHUB_TOKEN") # optional
577+
... )
572578
573579
>>> pin_paths = {"df_csv": "df_csv/20220214T163720Z-9bfad"}
574580
>>> board = BoardManual("pins/tests/pins-compat", fs, pin_paths=pin_paths)

pins/constructors.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ def board_local(versioned=True, allow_pickle_read=None):
150150

151151

152152
def board_github(
153-
org, repo, path="", versioned=True, cache=DEFAULT, allow_pickle_read=None
153+
org,
154+
repo,
155+
path="",
156+
token=None,
157+
versioned=True,
158+
cache=DEFAULT,
159+
allow_pickle_read=None,
154160
):
155161
"""Returns a github pin board.
156162
@@ -162,6 +168,8 @@ def board_github(
162168
Name of the repo.
163169
path:
164170
A subfolder in the github repo holding the board.
171+
token:
172+
An optional github token.
165173
**kwargs:
166174
Passed to the pins.board function.
167175
@@ -173,7 +181,9 @@ def board_github(
173181
Examples
174182
--------
175183
176-
>>> board = board_github("machow", "pins-python", "pins/tests/pins-compat")
184+
>>> import os
185+
>>> gh_token = os.environ.get("GITHUB_TOKEN")
186+
>>> board = board_github("machow", "pins-python", "pins/tests/pins-compat", gh_token)
177187
>>> board.pin_list()
178188
['df_arrow', 'df_csv', 'df_rds', 'df_unversioned']
179189

pins/tests/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ def create_tmp_board(self, src_board=None):
181181

182182
shutil.copytree(src_board, p_root)
183183

184-
for pin_entry in p_root.glob("*/*"):
184+
# note that glob order is technically arbitrary
185+
for pin_entry in sorted(p_root.glob("*/*"), key=lambda x: str(x)):
185186
# two key points:
186187
# 1. username is required when putting content bundles up
187188
# 2. the version must be removed.

0 commit comments

Comments
 (0)