The-Compiler / pytest-xvfb

A pytest plugin to run Xvfb (or Xephyr/Xvnc) for tests.
MIT License
70 stars 11 forks source link

Internal errors when running through Git Actions #24

Closed cspang1 closed 4 years ago

cspang1 commented 4 years ago

The following output occurs during a build with bare minimum example:


INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/main.py", line 187, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 820, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pytest_xvfb.py", line 93, in pytest_configure
INTERNALERROR>     config.xvfb.start()
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pytest_xvfb.py", line 46, in start
INTERNALERROR>     self._virtual_display.cmd.extend(self.args)
INTERNALERROR> AttributeError: 'Display' object has no attribute 'cmd'
  File "/opt/hostedtoolcache/Python/3.7.7/x64/bin/pytest", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 125, in main
    config=config
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/main.py", line 240, in pytest_cmdline_main
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/main.py", line 235, in wrap_session
    config._ensure_unconfigure()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/_pytest/config/__init__.py", line 825, in _ensure_unconfigure
    self.hook.pytest_unconfigure(config=self)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pytest_xvfb.py", line 99, in pytest_unconfigure
    config.xvfb.stop()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pytest_xvfb.py", line 61, in stop
    self._virtual_display.stop()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pyvirtualdisplay/display.py", line 76, in stop
    self._obj.stop()
  File "/opt/hostedtoolcache/Python/3.7.7/x64/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py", line 318, in stop
    raise XStartError("stop() is called before start().")
pyvirtualdisplay.abstractdisplay.XStartError: stop() is called before start().
##[error]Process completed with exit code 1.
cspang1 commented 4 years ago

Looks like this was due to a conflict with different version of xvfb installed.

cspang1 commented 4 years ago

It appears that was a red herring. The issue persists.

Everything works without the plugin and performing an explicit xvfb init:

sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
/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

But everything fails with the plugin.

My test is extremely simple, and works perfectly fine on my local machine:

import sys, os

sys.path.append(os.path.join(os.path.dirname(sys.path[0]), "src")) from jide import jide

def test_file_open(qtbot): print("start of test") temp = jide() qtbot.addWidget(temp) assert True I am running via Git Actions with the following script:

name: Build

on: push: branches: [ master ] pull_request: branches: [ master ]

jobs: build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
  uses: actions/setup-python@v2
  with:
    python-version: 3.7
- name: Cache
  uses: actions/cache@v2.0.0
  id: cache
  with:
    path: ~/.cache/pip
    key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
    restore-keys: |
      ${{ runner.os }}-test
- name: Install dependencies
  if: steps.cache.outputs.cache-hit != 'true'
  run: |
    python -m pip install --upgrade pip
    pip install flake8
    pip install -r requirements.txt
- name: Lint with flake8
  run: |
    flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
    flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
  run: |
    pytest
The-Compiler commented 4 years ago

Duplicate of #22

cspang1 commented 4 years ago

Google caching algorithm needs to work faster! Thanks for the reference.