Skip to content

Commit b86bf1a

Browse files
committed
Skip GUI tests if xvfb not installed
1 parent 52758b9 commit b86bf1a

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test
22
test:
33
python -m pytest --version
4-
python -m pytest --xvfb-backend=xvfb -v test/
4+
python -m pytest -v test/
55

66

77
.PHONY: lint

doc/contributing.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ make test
5555
```
5656

5757
Unit tests require `xvfb` (X Virtual Framebuffer) to test the GUI. If `xvfb` is not
58-
installed, you'll receive `ERROR: xvfb backend xvfb requested but not installed`.
59-
Install with:
58+
installed, GUI tests will be skipped. Install with:
6059

6160
```bash
6261
sudo apt install xvfb

test/test_gui.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
from pathlib import Path
22

3+
import pytest
4+
import pytest_xvfb
5+
36
from viscm.cli import _make_window
47

8+
xvfb_installed = pytest_xvfb.xvfb_instance is not None
9+
510

11+
@pytest.mark.skipif(
12+
not xvfb_installed,
13+
reason="Xvfb must be installed for this test.",
14+
)
615
class TestGui:
716
def test_gui_view_opens(self, qtbot):
817
window = _make_window(

0 commit comments

Comments
 (0)