Skip to content

Commit 433abae

Browse files
committed
Simplify tolerance reasoning in java_heap test
1 parent fa38c52 commit 433abae

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

tests/it/java_heap.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
import scyjava
1010

1111

12-
def magnitude(x: int) -> int:
13-
return math.floor(math.log10(abs(x)))
14-
15-
1612
mb_initial = 50 # initial MB of memory to snarf up
13+
mb_tolerance = 10 # ceiling of expected MB in use
1714

1815
scyjava.config.set_heap_min(mb=mb_initial)
1916
scyjava.config.set_heap_max(gb=1)
@@ -35,9 +32,7 @@ def magnitude(x: int) -> int:
3532
).is_less_than_or_equal_to(mb_max)
3633
assert_that(mb_max, "maximum heap size should be approx. 1 GB").is_between(900, 1024)
3734

38-
tolerance = pow(10, magnitude(mb_initial))
39-
40-
assert_that(mb_used, "most memory should be available").is_less_than(tolerance)
35+
assert_that(mb_used, "most memory should be available").is_less_than(mb_tolerance)
4136
assert_that(mb_total, "total memory should be close to initial").is_close_to(
42-
mb_initial, tolerance=tolerance
37+
mb_initial, tolerance=mb_tolerance
4338
)

0 commit comments

Comments
 (0)