Skip to content

Commit

Permalink
Fix beaker test (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh authored Jun 10, 2024
1 parent 8bb1012 commit 7008167
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/cached_path_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import shutil
import tempfile
import time
import uuid
from collections import Counter
from pathlib import Path

Expand Down Expand Up @@ -449,10 +450,25 @@ def beaker_available() -> bool:


class TestCachedPathBeaker(BaseTestClass):
def setup_method(self):
super().setup_method()

from beaker import Beaker

self.beaker = Beaker.from_env(default_workspace="cached-path-testing")
self.username = self.beaker.account.whoami().name
self.dataset_name = f"cached-path-{str(uuid.uuid4())[:8]}"
self.dataset = self.beaker.dataset.create(self.dataset_name, "README.md")
self.url = f"beaker://{self.username}/{self.dataset_name}/README.md"

def teardown_method(self):
super().teardown_method()
self.beaker.dataset.delete(self.dataset)

@flaky
@pytest.mark.skipif(not beaker_available(), reason="Beaker not configured")
def test_cache_object(self):
path = cached_path("beaker://petew/cached-path-readme/README.md")
path = cached_path(self.url)
assert path.is_file()
meta = Meta.from_path(_meta_file_path(path))
assert meta.etag is not None

0 comments on commit 7008167

Please sign in to comment.