Skip to content

Commit 8a380a9

Browse files
committed
add tests for versioned
1 parent a189472 commit 8a380a9

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

pins/boards.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def __init__(
6666
self.board = str(board)
6767
self.fs = fs
6868
self.meta_factory = meta_factory
69-
70-
# if versioned is False:
71-
# raise NotImplementedError()
72-
7369
self.versioned = versioned
7470
self.allow_pickle_read = allow_pickle_read
7571

@@ -355,7 +351,9 @@ def pin_write(
355351
"""
356352

357353
if versioned is False:
358-
raise NotImplementedError()
354+
raise NotImplementedError(
355+
"Can only write pins with boards that support versioning."
356+
)
359357

360358
if type == "file":
361359
raise NotImplementedError(

pins/constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def board_url(path: str, pin_paths: dict, cache=DEFAULT, allow_pickle_read=None)
370370
--------
371371
372372
```python
373-
github_raw = "https://raw.githubusercontent.com/machow/pins-python/main/pins/tests/pins-compat"
373+
github_raw = "https://raw.githubusercontent.com/rstudio/pins-python/main/pins/tests/pins-compat"
374374
pin_paths = {
375375
"df_csv": "df_csv/20220214T163720Z-9bfad/",
376376
"df_arrow": "df_arrow/20220214T163720Z-ad0c1/",

pins/tests/test_boards.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,8 @@ def test_board_rsc_pin_read_public(df, board_short):
600600

601601

602602
def test_board_manual_http_file_download():
603-
# TODO: change when repo is moved to RStudio
604603

605-
path = "https://raw.githubusercontent.com/machow/pins-python"
604+
path = "https://raw.githubusercontent.com/rstudio/pins-python"
606605
license_path = "main/LICENSE"
607606

608607
# use a simple cache, which automatically creates a temporary directory
@@ -630,7 +629,7 @@ def test_board_manual_pin_read():
630629
# see https://github.com/fsspec/filesystem_spec/issues/389
631630
fs = fsspec.filesystem("http", block_size=0)
632631
board = BoardManual(
633-
"https://raw.githubusercontent.com/machow/pins-python/main/pins/tests/pins-compat",
632+
"https://raw.githubusercontent.com/rstudio/pins-python/main/pins/tests/pins-compat",
634633
fs,
635634
pin_paths={
636635
"df_csv": "df_csv/20220214T163718Z-eceac/",

pins/tests/test_constructors.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def construct_from_board(board):
5959
# copied from test_compat
6060
@pytest.mark.skip_on_github
6161
def test_constructor_board_url_data(tmp_cache, http_example_board_path, df_csv):
62-
board = c.board_urls(
62+
board = c.board_url(
6363
http_example_board_path,
6464
# could derive from example version path
6565
pin_paths={"df_csv": "df_csv/20220214T163720Z-9bfad/"},
@@ -77,14 +77,21 @@ def test_constructor_board_url_cache(tmp_cache, http_example_board_path, df_csv)
7777
# TODO: downloading a pin does not put files in the same directory, since
7878
# in this case we are hashing on the full url.
7979

80-
board = c.board_urls(
80+
board = c.board_url(
8181
http_example_board_path,
8282
# could derive from example version path
8383
pin_paths={"df_csv": "df_csv/20220214T163718Z-eceac/"},
8484
)
8585

8686
board.pin_read("df_csv")
8787

88+
# cannot read or view pin versions
89+
90+
with pytest.raises(NotImplementedError):
91+
board.pin_write(df_csv)
92+
with pytest.raises(NotImplementedError):
93+
board.pin_versions("df_csv")
94+
8895
# check cache ----
8996
http_dirs = list(tmp_cache.glob("http_*"))
9097

@@ -107,7 +114,7 @@ def test_constructor_board_url_file(tmp_cache, http_example_board_path):
107114
# TODO: downloading a pin does not put files in the same directory, since
108115
# in this case we are hashing on the full url.
109116

110-
board = c.board_urls(
117+
board = c.board_url(
111118
http_example_board_path,
112119
# could derive from example version path
113120
pin_paths={"df_csv": "df_csv/20220214T163718Z-eceac/df_csv.csv"},

0 commit comments

Comments
 (0)