Skip to content

Skip DISPLAY check test locally if GDK_BACKEND=-#2367

Open
hgohel wants to merge 1 commit into
gramps-project:maintenance/gramps61from
hgohel:hgohel-ut-under-gdk-backend-env-var
Open

Skip DISPLAY check test locally if GDK_BACKEND=-#2367
hgohel wants to merge 1 commit into
gramps-project:maintenance/gramps61from
hgohel:hgohel-ut-under-gdk-backend-env-var

Conversation

@hgohel

@hgohel hgohel commented Jun 10, 2026

Copy link
Copy Markdown
Member

Unit test test_consistent_with_DISPLAY_env fails on Ubuntu 24.04 when GDK_BACKEND=- is set, and passes when it isn't.

This doesn't happen on GitHub in Gramps CI environment and the difference is that locally DISPLAY is set causing the test to fail, whereas on GitHub Gramps CI, DISPLAY is not set, allowing the test to pass.

To work around this, this test is skipped when GDK_BACKEND=- because that deliberately overrides display detection.

Unit test `test_consistent_with_DISPLAY_env` fails on Ubuntu 24.04 when `GDK_BACKEND=-` is set, and passes when it isn't.

This doesn't happen on GitHub in Gramps CI environment and the difference is that locally DISPLAY is set causing the test to fial, whereas on GitHub Gramps CI, DISPLAY is not set, allowing the test to pass.

To work around this, this test is skipped when GDK_BACKEND=- because that deliberately overrides display detection.
@hgohel

hgohel commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Output before code change:

Failure with GDK_BACKEND=-

$ env GDK_BACKEND=- env GRAMPS_RESOURCES=build/share python3 -m unittest gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env
F
======================================================================
FAIL: test_consistent_with_DISPLAY_env (gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/hgohel/dev/grprj/gramps/gramps/gen/test/constfunc_test.py", line 36, in test_consistent_with_DISPLAY_env
    self.assertEqual(
AssertionError: False != True : has_display(): False, $DISPLAY: :0

----------------------------------------------------------------------
Ran 1 test in 0.034s

FAILED (failures=1)

Pass without GDK_BACKEND

$ env GRAMPS_RESOURCES=build/share python3 -m unittest gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env
.
----------------------------------------------------------------------
Ran 1 test in 0.054s

OK

In both cases, the shell has these set:

WAYLAND_DISPLAY=wayland-0
DISPLAY=:0

Verified that with the fix the test is skipped when the env var is set, and executed when not set:

Output after code change

$ env GDK_BACKEND=- env GRAMPS_RESOURCES=build/share python3 -m unittest gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env -v
test_consistent_with_DISPLAY_env (gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env) ... skipped 'GDK_BACKEND=- overrides normal display detection'

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK (skipped=1)

$ env GRAMPS_RESOURCES=build/share python3 -m unittest gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env -v
test_consistent_with_DISPLAY_env (gramps.gen.test.constfunc_test.Test_has_display.test_consistent_with_DISPLAY_env) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.041s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant