Skip to content

Commit

Permalink
Skip GUI tests if xvfb not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 committed Jun 6, 2023
1 parent 52758b9 commit b86bf1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test
test:
python -m pytest --version
python -m pytest --xvfb-backend=xvfb -v test/
python -m pytest -v test/


.PHONY: lint
Expand Down
3 changes: 1 addition & 2 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ make test
```

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

```bash
sudo apt install xvfb
Expand Down
9 changes: 9 additions & 0 deletions test/test_gui.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from pathlib import Path

import pytest
import pytest_xvfb

from viscm.cli import _make_window

xvfb_installed = pytest_xvfb.xvfb_instance is not None


@pytest.mark.skipif(
not xvfb_installed,
reason="Xvfb must be installed for this test.",
)
class TestGui:
def test_gui_view_opens(self, qtbot):
window = _make_window(
Expand Down

0 comments on commit b86bf1a

Please sign in to comment.