Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips for contributors to run the webkit backend #8158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/contributing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,28 @@ specific one you can set either of a) the environment variable QUTE_TESTS_BACKEN
, or b) the command line argument --qute-backend, to the desired backend
(webkit/webengine).

If you need an environment with webkit installed to do testing while we still
support it (see #4039) you can re-use the docker container used for the CI
test runs which has PyQt5Webkit installed from the archlinux package archives.
Examples:

----
# Get a bash shell in the docker container with
# a) the current directory mounted at /work in the container
# b) the container using the X11 display :27 (for example, a Xephyr instance) from the host
# c) the tox and hypothesis dirs set to somewhere in the container that it can write to
# d) the system site packages available in the tox venv so you can use PyQt
# from the OS without having to run the link_pyqt script
docker run -it -v $PWD:/work:ro -w /work -e QUTE_TESTS_BACKEND=webkit -e DISPLAY=:27 -v /tmp/.X11-unix:/tmp/.X11-unix -e TOX_WORK_DIR="/home/user/.tox" -e HYPOTHESIS_EXAMPLES_DIR="/home/user/.hypothesis/examples" -e VIRTUALENV_SYSTEM_SITE_PACKAGES=True qutebrowser/ci:archlinux-webkit bash

# Start a qutebrowser temporary basedir in the appropriate tox environment to
# play with
tox exec -e py-qt5 -- python3 -m qutebrowser -T --backend webkit

# Run tests, passing positional args through to pytest.
tox -e py-qt5 -- tests/unit
----

Profiling
~~~~~~~~~

Expand Down
13 changes: 12 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import pytest
import hypothesis
import hypothesis.database

pytest.register_assert_rewrite('helpers')

Expand All @@ -33,10 +34,19 @@


# Set hypothesis settings
hypotheses_optional_kwargs = {}
if "HYPOTHESIS_EXAMPLES_DIR" in os.environ:
hypotheses_optional_kwargs[
"database"
] = hypothesis.database.DirectoryBasedExampleDatabase(
os.environ["HYPOTHESIS_EXAMPLES_DIR"]
)

hypothesis.settings.register_profile(
'default', hypothesis.settings(
deadline=600,
suppress_health_check=[hypothesis.HealthCheck.function_scoped_fixture],
**hypotheses_optional_kwargs,
)
)
hypothesis.settings.register_profile(
Expand All @@ -45,7 +55,8 @@
suppress_health_check=[
hypothesis.HealthCheck.function_scoped_fixture,
hypothesis.HealthCheck.too_slow
]
],
**hypotheses_optional_kwargs,
)
)
hypothesis.settings.load_profile('ci' if testutils.ON_CI else 'default')
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ envlist = py38-pyqt515-cov,mypy-pyqt5,misc,vulture,flake8,pylint,pyroma,check-ma
distshare = {toxworkdir}
skipsdist = true
minversion = 3.20
toxworkdir={env:TOX_WORK_DIR:{toxinidir}/.tox}

[testenv]
setenv =
Expand All @@ -30,6 +31,7 @@ passenv =
QT_QUICK_BACKEND
FORCE_COLOR
DBUS_SESSION_BUS_ADDRESS
HYPOTHESIS_EXAMPLES_DIR
basepython =
py: {env:PYTHON:python3}
py3: {env:PYTHON:python3}
Expand Down