diff --git a/plinth/conftest.py b/plinth/conftest.py index 9236f7fa6..6ab851b0c 100644 --- a/plinth/conftest.py +++ b/plinth/conftest.py @@ -223,7 +223,7 @@ def fixture_fix_session_browser_screenshots(request): continue value = fixture_def.cached_result[0] - should_take_screenshot = (hasattr(value, "__splinter_browser__") + should_take_screenshot = (hasattr(value, '__splinter_browser__') and splinter_make_screenshot_on_failure and getattr(request.node, 'splinter_failure', True)) @@ -250,3 +250,10 @@ def fixture_fix_session_browser_screenshots(request): } plugin._take_screenshot(**kwargs) + + +@pytest.fixture(name='host_sudo') +def fixture_host_sudo(host): + """Pytest fixture to run commands with sudo.""" + with host.sudo(): + yield host diff --git a/plinth/tests/functional/install.sh b/plinth/tests/functional/install.sh index a51cfbb1c..94ff71e82 100755 --- a/plinth/tests/functional/install.sh +++ b/plinth/tests/functional/install.sh @@ -5,7 +5,8 @@ IFS=$'\n\t' echo "Installing requirements" sudo apt-get install -yq --no-install-recommends \ python3-pytest python3-pytest-django python3-pytest-instafail \ - python3-pytest-xdist python3-pip python3-wheel firefox-esr git smbclient + python3-pytest-xdist python3-pip python3-wheel firefox-esr git smbclient \ + python3-testinfra # Use compatible versions of Splinter and Selenium PIP_VERSION=$(dpkg-query -W -f '${Version}' python3-pip)