Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cuda_core/tests/memory_ipc/test_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None:
# Check on a CLEAN exit only. `exc_type is not None` inverted this: the
# count was compared only when the body had already raised -- never on
# the path the two users of this class actually take -- and there the
# AssertionError replaced the exception the test was really reporting.
if exc_type is None:
gc.collect()
final_fds = self.process.num_fds()
assert final_fds == self.initial_fds
assert final_fds == self.initial_fds, (
f"leaked {final_fds - self.initial_fds} file descriptor(s): "
f"{self.initial_fds} open before the block, {final_fds} after"
)
return False


Expand Down
Loading