Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback mechanism for GUI mode #301

Merged
merged 12 commits into from
Dec 3, 2024
4 changes: 1 addition & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def ij(request):
legacy = request.config.getoption("--legacy")
headless = request.config.getoption("--headless")

imagej.when_imagej_starts(
lambda ij: setattr(ij, "_when_imagej_starts_result", "success")
)
imagej.when_imagej_starts(lambda ij: setattr(ij, "_testing", True))

mode = "headless" if headless else "interactive"
ij = imagej.init(ij_dir, mode=mode, add_legacy=legacy)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ def test_when_imagej_starts(ij):
when_imagej_starts, which injects a small piece of data into the gateway
object. We check for that data here to make sure the callback happened.
"""
assert "success" == getattr(ij, "_when_imagej_starts_result", None)
gselzer marked this conversation as resolved.
Show resolved Hide resolved
assert True is getattr(ij, "_testing", True)
elevans marked this conversation as resolved.
Show resolved Hide resolved