Skip to content
Snippets Groups Projects
Commit 6d5bee08 authored by Kentaro Wada's avatar Kentaro Wada
Browse files

Skip gui tests on GitHub Actions for now

```
============================= test session starts ==============================
platform linux -- Python 3.9.13, pytest-7.1.3, pluggy-1.0.0
PyQt5 5.15.7 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /home/runner/work/labelme/labelme
plugins: qt-3.3.0
collected 16 items

tests/labelme_tests/test_app.py Fatal Python error: Aborted

Current thread 0x00007fc834e3a280 (most recent call first):
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pytestqt/plugin.py", line 57 in qapp
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 900 in call_fixture_func
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 1121 in pytest_fixture_setup
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 1067 in execute
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 669 in _compute_fixture_value
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 583 in _get_active_fixturedef
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 564 in getfixturevalue
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/fixtures.py", line 551 in _fillfixtures
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/python.py", line 1764 in setup
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 491 in setup
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 154 in pytest_runtest_setup
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 259 in <lambda>
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 338 in from_call
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 258 in call_runtest_hook
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 219 in call_and_report
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 124 in runtestprotocol
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/runner.py", line 111 in pytest_runtest_protocol
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/main.py", line 347 in pytest_runtestloop
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/main.py", line 322 in _main
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/main.py", line 268 in wrap_session
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/main.py", line 315 in pytest_cmdline_main
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 164 in main
  File "/usr/share/miniconda/envs/test/lib/python3.9/site-packages/_pytest/config/__init__.py", line 187 in console_main
  File "/usr/share/miniconda/envs/test/bin/pytest", line 8 in <module>
Aborted (core dumped)
Error: Process completed with exit code 134.
```
parent a37aa205
Branches
No related tags found
No related merge requests found
...@@ -26,16 +26,16 @@ jobs: ...@@ -26,16 +26,16 @@ jobs:
auto-update-conda: true auto-update-conda: true
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install system dependencies # - name: Install system dependencies
shell: bash -l {0} # shell: bash -l {0}
run: | # run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then # if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
sudo apt-get install -y coreutils # sudo apt-get install -y coreutils
sudo apt-get install -y xvfb herbstluftwm # sudo apt-get install -y xvfb herbstluftwm
elif [ "${{ matrix.os }}" = "macos-latest" ]; then # elif [ "${{ matrix.os }}" = "macos-latest" ]; then
brew install coreutils # brew install coreutils
brew install --cask xquartz # brew install --cask xquartz
fi # fi
- name: Set up Python - name: Set up Python
shell: bash -l {0} shell: bash -l {0}
...@@ -79,17 +79,17 @@ jobs: ...@@ -79,17 +79,17 @@ jobs:
if: matrix.os != 'windows-latest' && !(matrix.os == 'macos-latest' && matrix.PYTEST_QT_API == 'pyside2') if: matrix.os != 'windows-latest' && !(matrix.os == 'macos-latest' && matrix.PYTEST_QT_API == 'pyside2')
env: env:
PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }} PYTEST_QT_API: ${{ matrix.PYTEST_QT_API }}
MPLBACKEND: 'agg'
run: | run: |
# open virtual display # # open virtual display
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then # if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
export DISPLAY=:99.0 # export DISPLAY=:99.0
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset # /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset
(herbstluftwm )& # (herbstluftwm )&
else # else
(sudo Xvfb :99 -ac -screen 0 1024x768x8 )& # (sudo Xvfb :99 -ac -screen 0 1024x768x8 )&
fi # fi
# run test pytest -vs -m 'not gui' tests/
MPLBACKEND='agg' pytest tests/
- name: Run examples - name: Run examples
shell: bash -l {0} shell: bash -l {0}
......
...@@ -2,6 +2,8 @@ import os.path as osp ...@@ -2,6 +2,8 @@ import os.path as osp
import shutil import shutil
import tempfile import tempfile
import pytest
import labelme.app import labelme.app
import labelme.config import labelme.config
import labelme.testing import labelme.testing
...@@ -21,6 +23,7 @@ def _win_show_and_wait_imageData(qtbot, win): ...@@ -21,6 +23,7 @@ def _win_show_and_wait_imageData(qtbot, win):
qtbot.waitUntil(check_imageData) # wait for loadFile qtbot.waitUntil(check_imageData) # wait for loadFile
@pytest.mark.gui
def test_MainWindow_open(qtbot): def test_MainWindow_open(qtbot):
win = labelme.app.MainWindow() win = labelme.app.MainWindow()
qtbot.addWidget(win) qtbot.addWidget(win)
...@@ -28,6 +31,7 @@ def test_MainWindow_open(qtbot): ...@@ -28,6 +31,7 @@ def test_MainWindow_open(qtbot):
win.close() win.close()
@pytest.mark.gui
def test_MainWindow_open_img(qtbot): def test_MainWindow_open_img(qtbot):
img_file = osp.join(data_dir, "raw/2011_000003.jpg") img_file = osp.join(data_dir, "raw/2011_000003.jpg")
win = labelme.app.MainWindow(filename=img_file) win = labelme.app.MainWindow(filename=img_file)
...@@ -36,6 +40,7 @@ def test_MainWindow_open_img(qtbot): ...@@ -36,6 +40,7 @@ def test_MainWindow_open_img(qtbot):
win.close() win.close()
@pytest.mark.gui
def test_MainWindow_open_json(qtbot): def test_MainWindow_open_json(qtbot):
json_files = [ json_files = [
osp.join(data_dir, "annotated_with_data/apc2016_obj3.json"), osp.join(data_dir, "annotated_with_data/apc2016_obj3.json"),
...@@ -50,6 +55,7 @@ def test_MainWindow_open_json(qtbot): ...@@ -50,6 +55,7 @@ def test_MainWindow_open_json(qtbot):
win.close() win.close()
@pytest.mark.gui
def test_MainWindow_open_dir(qtbot): def test_MainWindow_open_dir(qtbot):
directory = osp.join(data_dir, "raw") directory = osp.join(data_dir, "raw")
win = labelme.app.MainWindow(filename=directory) win = labelme.app.MainWindow(filename=directory)
...@@ -58,16 +64,19 @@ def test_MainWindow_open_dir(qtbot): ...@@ -58,16 +64,19 @@ def test_MainWindow_open_dir(qtbot):
return win return win
@pytest.mark.gui
def test_MainWindow_openNextImg(qtbot): def test_MainWindow_openNextImg(qtbot):
win = test_MainWindow_open_dir(qtbot) win = test_MainWindow_open_dir(qtbot)
win.openNextImg() win.openNextImg()
@pytest.mark.gui
def test_MainWindow_openPrevImg(qtbot): def test_MainWindow_openPrevImg(qtbot):
win = test_MainWindow_open_dir(qtbot) win = test_MainWindow_open_dir(qtbot)
win.openNextImg() win.openNextImg()
@pytest.mark.gui
def test_MainWindow_annotate_jpg(qtbot): def test_MainWindow_annotate_jpg(qtbot):
tmp_dir = tempfile.mkdtemp() tmp_dir = tempfile.mkdtemp()
input_file = osp.join(data_dir, "raw/2011_000003.jpg") input_file = osp.join(data_dir, "raw/2011_000003.jpg")
......
import pytest
from qtpy import QtCore from qtpy import QtCore
from qtpy import QtWidgets from qtpy import QtWidgets
...@@ -5,6 +6,7 @@ from labelme.widgets import LabelDialog ...@@ -5,6 +6,7 @@ from labelme.widgets import LabelDialog
from labelme.widgets import LabelQLineEdit from labelme.widgets import LabelQLineEdit
@pytest.mark.gui
def test_LabelQLineEdit(qtbot): def test_LabelQLineEdit(qtbot):
list_widget = QtWidgets.QListWidget() list_widget = QtWidgets.QListWidget()
list_widget.addItems(["cat", "dog", "person"]) list_widget.addItems(["cat", "dog", "person"])
...@@ -29,6 +31,7 @@ def test_LabelQLineEdit(qtbot): ...@@ -29,6 +31,7 @@ def test_LabelQLineEdit(qtbot):
assert widget.text() == "person" assert widget.text() == "person"
@pytest.mark.gui
def test_LabelDialog_addLabelHistory(qtbot): def test_LabelDialog_addLabelHistory(qtbot):
labels = ["cat", "dog", "person"] labels = ["cat", "dog", "person"]
widget = LabelDialog(labels=labels, sort_labels=True) widget = LabelDialog(labels=labels, sort_labels=True)
...@@ -42,6 +45,7 @@ def test_LabelDialog_addLabelHistory(qtbot): ...@@ -42,6 +45,7 @@ def test_LabelDialog_addLabelHistory(qtbot):
assert item.text() == "bicycle" assert item.text() == "bicycle"
@pytest.mark.gui
def test_LabelDialog_popUp(qtbot): def test_LabelDialog_popUp(qtbot):
labels = ["cat", "dog", "person"] labels = ["cat", "dog", "person"]
widget = LabelDialog(labels=labels, sort_labels=True) widget = LabelDialog(labels=labels, sort_labels=True)
......
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
import pytest
from labelme.widgets import LabelListWidget from labelme.widgets import LabelListWidget
from labelme.widgets import LabelListWidgetItem from labelme.widgets import LabelListWidgetItem
@pytest.mark.gui
def test_LabelListWidget(qtbot): def test_LabelListWidget(qtbot):
widget = LabelListWidget() widget = LabelListWidget()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment