Skip to content

Commit

Permalink
Cleanup pytests for unused and redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
doulikecookiedough committed Sep 12, 2024
1 parent 93d81eb commit 79ab4f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
8 changes: 1 addition & 7 deletions tests/test_filehashstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,17 +1075,14 @@ def test_create_path(pids, store):

def test_get_real_path_file_does_not_exist(store):
"""Test get_real_path returns None when object does not exist."""
entity = "objects"
test_path = "tests/testdata/helloworld.txt"
with pytest.raises(FileNotFoundError):
real_path_exists = store._get_hashstore_data_object_path(test_path)
# assert real_path_exists is None
store._get_hashstore_data_object_path(test_path)


def test_get_real_path_with_object_id(store, pids):
"""Test get_real_path returns absolute path given an object id."""
test_dir = "tests/testdata/"
entity = "objects"
for pid in pids.keys():
path = test_dir + pid.replace("/", "_")
object_metadata = store._store_and_validate_data(pid, path)
Expand All @@ -1096,7 +1093,6 @@ def test_get_real_path_with_object_id(store, pids):
def test_get_real_path_with_object_id_sharded(pids, store):
"""Test exists method with a sharded path (relative path)."""
test_dir = "tests/testdata/"
entity = "objects"
for pid in pids.keys():
path = test_dir + pid.replace("/", "_")
object_metadata = store._store_and_validate_data(pid, path)
Expand All @@ -1108,7 +1104,6 @@ def test_get_real_path_with_object_id_sharded(pids, store):

def test_get_real_path_with_metadata_id(store, pids):
"""Test get_real_path returns absolute path given a metadata id."""
entity = "metadata"
test_dir = "tests/testdata/"
format_id = "https://ns.dataone.org/service/types/v2.0#SystemMetadata"
for pid in pids.keys():
Expand All @@ -1122,7 +1117,6 @@ def test_get_real_path_with_metadata_id(store, pids):
def test_build_hashstore_data_object_path(store, pids):
"""Test _build_hashstore_data_object_path builds the hashstore data object file path."""
test_dir = "tests/testdata/"
entity = "objects"
for pid in pids.keys():
path = test_dir + pid.replace("/", "_")
_ = store._store_and_validate_data(pid, path)
Expand Down
5 changes: 1 addition & 4 deletions tests/test_filehashstore_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
CidRefsContentError,
CidRefsFileNotFound,
HashStoreRefsAlreadyExists,
NonMatchingChecksum,
NonMatchingObjSize,
PidAlreadyExistsError,
PidRefsContentError,
PidRefsFileNotFound,
UnsupportedAlgorithm,
)

# pylint: disable=W0212
Expand Down Expand Up @@ -79,7 +76,7 @@ def test_tag_object_cid_refs_file_content(pids, store):


def test_tag_object_pid_refs_found_cid_refs_found(pids, store):
"""Test tag_object does not throws exception when the refs files already exist
"""Test tag_object does not throw an exception when any refs file already exists
and verifies the content, and does not double tag the cid refs file."""
test_dir = "tests/testdata/"
for pid in pids.keys():
Expand Down

0 comments on commit 79ab4f0

Please sign in to comment.