Skip to content

Commit

Permalink
debug ci
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski committed Feb 19, 2025
1 parent 735553f commit f4382c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
1 change: 0 additions & 1 deletion disk_objectstore/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:

def __del__(self) -> None:
"""Closes all connections on deletion."""
breakpoint()
self.close()

def _get_sandbox_folder(self) -> Path:
Expand Down
23 changes: 17 additions & 6 deletions tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,9 @@ def test_get_objects_stream_closes(temp_dir, generate_random_data):
"""
# Check if it starts with 0 open files
current_process = psutil.Process()
assert len(current_process.open_files()) == 0
assert 0 == len(
current_process.open_files()
), "No files should be open at the beginning of test. Maybe some test did not properly close its files."

temp_container = Container(temp_dir)
temp_container.init_container()
Expand Down Expand Up @@ -1282,19 +1284,28 @@ def test_get_objects_stream_closes(temp_dir, generate_random_data):

# Check if it goes back to 0
temp_container.close()
assert len(current_process.open_files()) == 0
assert len(current_process.open_files()) == 0


def test_deletion_closes_file_descriptors(temp_dir):
def test_deletion_closes_file_descriptors(temp_dir, generate_random_data):
"""Test if deletion of container closes correctly open file descriptors."""

current_process = psutil.Process()
before_init_open_files = len(current_process.open_files())
assert 0 == len(
current_process.open_files()
), "No files should be open at the beginning of test. Maybe some test did not properly close its files."

# Open files
temp_container = Container(temp_dir)
temp_container.init_container()
temp_container.init_container(clear=True)
# For Linux to open files it is required to reading from container, on macOS
# the initialization of container is enough
data = generate_random_data()
obj_md5s = _add_objects_loose_loop(temp_container, data)
_ = temp_container.get_objects_content(obj_md5s.keys())

# Checks if initalisation actually opens files
assert before_init_open_files < len(
assert 0 < len(
current_process.open_files()
), "No files have been opened during initalisation"

Expand Down

0 comments on commit f4382c3

Please sign in to comment.