Repository: scijava/scyjava (language: python)

Issue:
Several issues running make test on osx-arm64 machine
👋 I was trying to set up this repo to make a contribution or two and ran tests from main and noticed a few issues:

1. (actually before `make test`) `flake8-typing-imports` for osx-arm64 hasn't been uploaded to conda-forge
2. the `java_heap.py` tests use `5 MB` for comparing used memory, which I guess doesn't work well on these M chips since the memory used on my laptop was `6 MB` 😂 

P.S. for some comedy check out my too many repos issue [blunder](https://github.com/imagej/pyimagej/issues/310)


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7aa9b17a..a7c3422c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,8 +23,8 @@ jobs:
         ]
         python-version: [
           '3.8',
-          '3.9',
-          '3.10'
+          '3.10',
+          '3.12'
         ]
 
     steps:
diff --git a/dev-environment.yml b/dev-environment.yml
index ca3722a5..03444184 100644
--- a/dev-environment.yml
+++ b/dev-environment.yml
@@ -28,11 +28,11 @@ dependencies:
   - numpy
   - pandas
   # Developer tools
+  - assertpy
   - autopep8
   - black
   - build
   - flake8
-  - flake8-typing-imports
   - isort
   - pytest
   - pytest-cov
@@ -42,5 +42,6 @@ dependencies:
   - pip:
     - git+https://github.com/ninia/jep.git@cfca63f8b3398daa6d2685428660dc4b2bfab67d
     - flake8-pyproject
+    - flake8-typing-imports
     - validate-pyproject[all]
     - -e .
diff --git a/pyproject.toml b/pyproject.toml
index 73b85600..56679eb4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,6 +39,7 @@ dependencies = [
 [project.optional-dependencies]
 # NB: Keep this in sync with dev-environment.yml!
 dev = [
+    "assertpy",
     "autopep8",
     "black",
     "build",


Test patch:
diff --git a/tests/it/java_heap.py b/tests/it/java_heap.py
index 4f51c74d..0d0461a9 100644
--- a/tests/it/java_heap.py
+++ b/tests/it/java_heap.py
@@ -2,9 +2,12 @@
 Test scyjava JVM memory-related functions.
 """
 
+from assertpy import assert_that
+
 import scyjava
 
 mb_initial = 50  # initial MB of memory to snarf up
+mb_tolerance = 10  # ceiling of expected MB in use
 
 scyjava.config.set_heap_min(mb=mb_initial)
 scyjava.config.set_heap_max(gb=1)
@@ -18,17 +21,15 @@
 mb_total = scyjava.memory_total() // 1024 // 1024
 mb_used = scyjava.memory_used() // 1024 // 1024
 
-# Used memory should be less than the current memory total,
-# which should be less than the maximum heap size.
-assert mb_used <= mb_total <= mb_max, f"{mb_used=} {mb_total=} {mb_max=}"
-
-# The maximum heap size should be approximately 1 GB.
-assert 900 <= mb_max <= 1024, f"{mb_max=}"
-
-# Most of that memory should still be free; i.e.,
-# we should not be using more than a few MB yet.
-assert mb_used <= 5, f"{mb_used=}"
-
-# The total MB available to Java at this moment
-# should be close to our requested initial amount.
-assert abs(mb_total - mb_initial) < 5, f"{mb_total=} {mb_initial=}"
+assert_that(
+    mb_used, "Used memory should be less than the current memory total"
+).is_less_than_or_equal_to(mb_total)
+assert_that(
+    mb_total, "current memory total should be less than maximum memory"
+).is_less_than_or_equal_to(mb_max)
+assert_that(mb_max, "maximum heap size should be approx. 1 GB").is_between(900, 1024)
+
+assert_that(mb_used, "most memory should be available").is_less_than(mb_tolerance)
+assert_that(mb_total, "total memory should be close to initial").is_close_to(
+    mb_initial, tolerance=mb_tolerance
+)