Skip to content

Commit

Permalink
modified test to skip repo creation during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
merveenoyan committed Jul 21, 2022
1 parent 792af11 commit da18a5a
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,19 @@ def setUp(self):
logger.info(
f"Does {WORKING_REPO_DIR} exist: {os.path.exists(WORKING_REPO_DIR)}"
)

self.REPO_NAME = repo_name()
self._repo_url = self._api.create_repo(
repo_id=self.REPO_NAME, token=self._token
)
self._api.upload_file(
path_or_fileobj=BytesIO(b"some initial binary data: \x00\x01"),
path_in_repo="random_file.txt",
repo_id=f"{USER}/{self.REPO_NAME}",
token=self._token,
)
# skip creation of repository for clone from test
if self.shortDescription() != "SKIP CREATION":
self._repo_url = self._api.create_repo(
repo_id=self.REPO_NAME, token=self._token
)
self._api.upload_file(
path_or_fileobj=BytesIO(b"some initial binary data: \x00\x01"),
path_in_repo="random_file.txt",
repo_id=f"{USER}/{self.REPO_NAME}",
token=self._token,
)

def tearDown(self):
try:
Expand Down Expand Up @@ -141,6 +144,7 @@ def test_clone_from_space(self):
)

def test_clone_from_deprecation_warning(self):
"""SKIP CREATION"""
with pytest.raises(
FutureWarning,
match="Creating a repository through clone_from is deprecated*",
Expand All @@ -149,6 +153,7 @@ def test_clone_from_deprecation_warning(self):
WORKING_REPO_DIR,
clone_from=f"{USER}/{uuid.uuid4()}",
use_auth_token=self._token,
repo_type="dataset",
)

def test_clone_from_model(self):
Expand Down

0 comments on commit da18a5a

Please sign in to comment.