Skip to content

Commit 0f98739

Browse files
author
Dimitar Tasev
committed
Make test a bit more robust
1 parent 68c3042 commit 0f98739

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mantidimaging/core/parallel/test/utility_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,19 @@ def test_execute_impl_par(mock_pool):
4242

4343

4444
def test_free_all_owned_by_this_instance():
45-
[sa.delete(x.name.decode("utf-8")) for x in sa.list()]
4645
create_array((10, 10), np.float32, random_name=True)
4746
create_array((10, 10), np.float32, random_name=True)
4847
create_array((10, 10), np.float32, random_name=True)
4948

5049
temp_name = "not_this_instance"
5150
sa.create("not_this_instance", (10, 10))
5251

53-
assert len(sa.list()) == 4
52+
# these tests run in parallel, this should avoid some race conditions at least
53+
initial = len(sa.list())
54+
# frees the 3 allocated above
5455
free_all_owned_by_this_instance()
55-
assert len(sa.list()) == 1
56+
expected = initial - 3
57+
assert len(sa.list()) == expected
5658
sa.delete(temp_name)
5759

5860

0 commit comments

Comments
 (0)