Skip to content

The Runtime is leaky #132

@aliddell

Description

@aliddell

See test failures in this commit vs. successes in this commit in #126. Here's the diff:

diff --git a/tests/test_basic.py b/tests/test_basic.py
index 9f2a98f..8ef4b7d 100644
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -11,16 +11,10 @@ import pytest
 import tifffile
 
 
-@pytest.fixture(scope="module")
-def _runtime():
-    runtime = acquire.Runtime()
-    yield runtime
-
-
+# FIXME (aliddell): this should be module scoped, but the runtime is leaky
 @pytest.fixture(scope="function")
-def runtime(_runtime: Runtime):
-    yield _runtime
-    _runtime.set_configuration(acquire.Properties())
+def runtime():
+    yield acquire.Runtime()
 
 
 def test_set():
diff --git a/tests/test_zarr.py b/tests/test_zarr.py
index b3cdb5a..6511805 100644
--- a/tests/test_zarr.py
+++ b/tests/test_zarr.py
@@ -16,16 +16,10 @@ import acquire
 from acquire import Runtime, DeviceKind
 
 
-@pytest.fixture(scope="module")
-def _runtime():
-    runtime = acquire.Runtime()
-    yield runtime
-
-
+# FIXME (aliddell): this should be module scoped, but the runtime is leaky
 @pytest.fixture(scope="function")
-def runtime(_runtime: acquire.Runtime):
-    yield _runtime
-    _runtime.set_configuration(acquire.Properties())
+def runtime():
+    yield acquire.Runtime()
 
 
 def test_write_external_metadata_to_zarr(

The only change is setting the scope of the Runtime to "function". Reusing the runtime across tests seems to result in data carryover from one test to the next. Given that these tests are meant to reflect isolated usages of the runtime and not a scripted series of actions, this is an appropriate change. However, users will probably expect to be able to use the runtime in a "memoryless" fashion, so we should address this problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Priority Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions