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

python3Packages.pywebview: build fix for tests #353833

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions pkgs/development/python-modules/pywebview/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if you made upstream aware of this so that they can both fix the tests and provide a mechanism for disabling individual tests. Please link the issue if you do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(While you're at it you could also ask them to make these faster and/or parallelise them; my god are these slow.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already had the upstream issue opened to figure out why the run.sh is structured the way it is, and I only just got a response that I'll have to ponder for a bit.
Considering that the tests most likely do actual graphical things (otherwise the xvfb-run wouldn't be needed) I wouldn't get my hopes up about parallel execution.

It is on my todo list.

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" ];
Expand Down