flent: convert to unittestCheckHook and add passthru.updateScript (#361633)

This commit is contained in:
Aleksana
2024-12-07 23:34:25 +08:00
committed by GitHub
+8 -19
View File
@@ -4,7 +4,7 @@
fetchPypi,
procps,
qt5,
xvfb-run,
nix-update-script,
}:
python3Packages.buildPythonApplication rec {
pname = "flent";
@@ -25,28 +25,15 @@ python3Packages.buildPythonApplication rec {
qtpy
];
nativeCheckInputs = [
python3Packages.mock
xvfb-run
];
checkPhase = ''
runHook preCheck
nativeCheckInputs = [ python3Packages.unittestCheckHook ];
preCheck = ''
# we want the gui tests to always run
sed -i 's|self.skip|pass; #&|' unittests/test_gui.py
export XDG_RUNTIME_DIR=$(mktemp -d)
export HOME=$(mktemp -d)
cat >test-runner <<EOF
#!/bin/sh
${python3Packages.python.interpreter} -m unittest discover
EOF
chmod +x test-runner
wrapQtApp test-runner --prefix PYTHONPATH : $PYTHONPATH
xvfb-run -s '-screen 0 800x600x24' ./test-runner
runHook postCheck
# Dummy qt setup for gui tests
export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM=offscreen
'';
preFixup = ''
@@ -56,11 +43,13 @@ python3Packages.buildPythonApplication rec {
)
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "FLExible Network Tester";
homepage = "https://flent.org";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ mmlb ];
mainProgram = "flent";
badPlatforms = lib.platforms.darwin;
};
}