2022-03-30 19:20:40 +00:00
|
|
|
# For testing, you will need:
|
|
|
|
# * PyQt5 dev tools
|
|
|
|
# * tox
|
|
|
|
# * X virtual framebuffer--to test without GUI
|
|
|
|
#
|
|
|
|
# Install these by running:
|
|
|
|
# $ sudo apt install pyqt5-dev-tools xvfb
|
|
|
|
# $ python3 -m pip install --user --upgrade tox
|
|
|
|
#
|
|
|
|
# Then, to run tests against multiple anki versions:
|
|
|
|
# $ tox
|
|
|
|
#
|
|
|
|
# To run tests slightly less safely, but faster:
|
|
|
|
# $ tox -- --no-tear-down-profile-after-each-test
|
|
|
|
#
|
|
|
|
# To run tests more safely, but *much* slower:
|
|
|
|
# $ tox -- --forked
|
|
|
|
|
|
|
|
# Test tool cheat sheet:
|
|
|
|
# * Test several environments in parallel:
|
|
|
|
# $ tox -p auto
|
|
|
|
#
|
|
|
|
# * To activate one of the test environments:
|
|
|
|
# $ source .tox/py38-anki49/bin/activate
|
|
|
|
#
|
|
|
|
# * Stop on first failure:
|
|
|
|
# $ xvfb-run python -m pytest -x
|
|
|
|
#
|
|
|
|
# * See stdout/stderr (doesn't work with --forked!):
|
|
|
|
# $ xvfb-run python -m pytest -s
|
|
|
|
#
|
|
|
|
# * Run some specific tests:
|
|
|
|
# $ xvfb-run python -m pytest -k "test_cards.py or test_guiBrowse"
|
|
|
|
#
|
|
|
|
# * To run with visible GUI in WSL2
|
|
|
|
# (Make sure to disable access control in your X server, such as VcXsrv):
|
|
|
|
# $ DISPLAY=$(ip route list default | awk '{print $3}'):0 python -m pytest
|
|
|
|
#
|
|
|
|
# * Environmental variables of interest:
|
|
|
|
# LIBGL_ALWAYS_INDIRECT=1
|
|
|
|
# QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu"
|
|
|
|
# QT_DEBUG_PLUGINS=1
|
2022-04-12 22:09:04 +00:00
|
|
|
# ANKIDEV=1
|
2022-03-30 19:20:40 +00:00
|
|
|
|
2022-06-07 22:04:13 +00:00
|
|
|
# Note: pypi packages anki and aqt do not pin their dependencies.
|
|
|
|
# To tests against historically accurate dependencies, we use a “time machine”
|
|
|
|
# that prevents pip from using packages that were uploaded after a specified date.
|
|
|
|
|
2022-03-30 19:20:40 +00:00
|
|
|
[tox]
|
|
|
|
minversion = 3.24
|
|
|
|
skipsdist = true
|
|
|
|
skip_install = true
|
2022-06-07 22:04:13 +00:00
|
|
|
requires =
|
|
|
|
pypi-timemachine
|
|
|
|
envlist =
|
|
|
|
py38-anki2.1.{45,46,47,48,49}
|
2022-06-07 22:46:52 +00:00
|
|
|
py39-anki2.1.{50,51,52,53}-qt{5,6}
|
2022-06-07 22:04:13 +00:00
|
|
|
|
|
|
|
[testenv:.tox]
|
|
|
|
install_command =
|
|
|
|
python -m pip install {packages}
|
2022-03-30 19:20:40 +00:00
|
|
|
|
|
|
|
[testenv]
|
2022-06-07 22:04:13 +00:00
|
|
|
install_command =
|
|
|
|
bash tox-install-command {envname} {toxworkdir} {packages}
|
|
|
|
|
2022-03-30 19:20:40 +00:00
|
|
|
commands =
|
2022-04-15 20:49:46 +00:00
|
|
|
env HOME={envtmpdir}/home xvfb-run python -m pytest {posargs}
|
2022-06-07 22:04:13 +00:00
|
|
|
|
2022-03-30 19:20:40 +00:00
|
|
|
setenv =
|
2022-06-07 22:04:13 +00:00
|
|
|
DISABLE_QT5_COMPAT=1
|
2022-12-27 03:04:10 +00:00
|
|
|
QTWEBENGINE_CHROMIUM_FLAGS=--no-sandbox
|
2022-06-07 22:04:13 +00:00
|
|
|
|
|
|
|
!qt{5,6}: AQT=aqt
|
|
|
|
qt5: AQT=aqt[qt5]
|
|
|
|
qt6: AQT=aqt[qt6]
|
|
|
|
|
2022-03-30 19:20:40 +00:00
|
|
|
allowlist_externals =
|
2022-06-07 22:04:13 +00:00
|
|
|
bash
|
2022-04-15 20:49:46 +00:00
|
|
|
env
|
2022-03-30 19:20:40 +00:00
|
|
|
xvfb-run
|
2022-06-07 22:04:13 +00:00
|
|
|
|
2022-03-30 19:20:40 +00:00
|
|
|
deps =
|
|
|
|
pytest==7.1.1
|
|
|
|
pytest-forked==1.4.0
|
2022-04-12 22:09:04 +00:00
|
|
|
pytest-anki @ git+https://github.com/oakkitten/pytest-anki.git@a0d27aa5
|