python3Packages.pywebview: build fix for tests (#353833)

This commit is contained in:
Atemu 2024-11-11 01:45:41 +01:00 committed by GitHub
commit f475d75050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,21 +50,17 @@ buildPythonPackage rec {
];
checkPhase = ''
# Cannot create directory /homeless-shelter/.... Error: FILE_ERROR_ACCESS_DENIED
export HOME=$TMPDIR
# QStandardPaths: XDG_RUNTIME_DIR not set
export XDG_RUNTIME_DIR=$HOME/xdg-runtime-dir
# a Qt wrapper is required to run the Qt backend
# since the upstream script does not have a way to disable tests individually pytest is used directly instead
makeQtWrapper "$(command -v pytest)" tests/run.sh \
--set PYWEBVIEW_LOG debug \
--add-flags "--deselect tests/test_js_api.py::test_concurrent"
pushd tests
substituteInPlace run.sh \
--replace "PYTHONPATH=.." "PYTHONPATH=$PYTHONPATH" \
--replace "pywebviewtest test_js_api.py::test_concurrent ''${PYTEST_OPTIONS}" "# skip flaky test_js_api.py::test_concurrent"
patchShebangs run.sh
wrapQtApp run.sh
xvfb-run -s '-screen 0 800x600x24' ./run.sh
popd
# HOME and XDG directories are required for the tests
env \
HOME=$TMPDIR \
XDG_RUNTIME_DIR=$TMPDIR/xdg-runtime-dir \
xvfb-run -s '-screen 0 800x600x24' tests/run.sh
'';
pythonImportsCheck = [ "webview" ];