Skip to content

Commit

Permalink
try to make test work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Nov 18, 2024
1 parent 9d3c304 commit 25e55d2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/matrixstore/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_save(self, tmp_path: str, matrix_format: str) -> None:
# then a file is created in the repo directory
matrix_file = bucket_dir.joinpath(f"{matrix_hash}.{matrix_format}")
assert matrix_file.exists()
assert matrix_file.with_suffix(".tsv.lock").exists()
assert bucket_dir.joinpath(f"{matrix_hash}.tsv.lock").exists()
array = matrix_format.load_matrix(matrix_file)
assert array.tolist() == data
modif_time = matrix_file.stat().st_mtime
Expand Down Expand Up @@ -304,7 +304,8 @@ def test_mixed_formats(self, tmp_path: str, matrix_format: str) -> None:
associated_hash = "d73f023a3f852bf2e5c6d836cd36cd930d0091dcba7f778161c707e1c58222b0"
matrix_path = matrix_content_repo.bucket_dir.joinpath(f"{associated_hash}.{saved_format}")
saved_format.save_matrix(df, matrix_path)
matrix_path.with_suffix(".tsv.lock").touch()
lock_path = matrix_content_repo.bucket_dir.joinpath(f"{associated_hash}.tsv.lock")
lock_path.touch()

# asserts the saved matrix object exists
assert matrix_content_repo.exists(associated_hash)
Expand All @@ -322,12 +323,13 @@ def test_mixed_formats(self, tmp_path: str, matrix_format: str) -> None:

# Recreates the matrix
saved_format.save_matrix(df, matrix_path)
matrix_path.with_suffix(".tsv.lock").touch()
lock_path.touch()
# saving the same matrix will migrate its format to the repository one.
matrix_content_repo.save(data)
assert matrix_path.with_suffix(".tsv.lock").exists()
assert lock_path.exists()
saved_matrix_files = list(matrix_content_repo.bucket_dir.glob(f"*.{matrix_format}"))
assert not saved_matrix_files
repo_matrix_files = list(matrix_content_repo.bucket_dir.glob(f"*.{repository_format}"))
assert len(repo_matrix_files) == 1
assert repo_matrix_files[0] == matrix_path.with_suffix(f".{repository_format}")
new_matrix_path = matrix_content_repo.bucket_dir.joinpath(f"{associated_hash}.{repository_format}")
assert repo_matrix_files[0] == new_matrix_path

0 comments on commit 25e55d2

Please sign in to comment.