python3Packages.snappy: add sage tests

see
https://github.com/3-manifolds/SnapPy/blob/3.3_as_released/.github/workflows/sage_test.yml
This commit is contained in:
Alex Epelde
2026-03-22 16:08:28 -04:00
parent f242b99ce7
commit ae0854e9dc
@@ -1,16 +1,22 @@
{
lib,
stdenv,
fetchpatch,
fetchFromGitHub,
python,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-time dependencies
setuptools,
cypari,
cython,
# non-Python runtime dependencies
libGL,
# Python runtime dependencies
cypari,
fxrays,
ipython,
libGL,
low-index,
packaging,
pickleshare,
@@ -20,9 +26,16 @@
snappy-15-knots,
snappy-manifolds,
spherogram,
tkinter-gl,
# documentation
sphinxHook,
sphinx-rtd-theme,
tkinter-gl,
# tests
runCommand,
sage,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
@@ -58,7 +71,7 @@ buildPythonPackage rec {
postPatch =
lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace setup.py \
--replace-fail "/usr/include/GL" "${libGL.dev}/include/GL"
--replace-fail "/usr/include/GL" "${lib.getDev libGL}/include/GL"
substituteInPlace freedesktop/share/applications/snappy.desktop \
--replace-fail "Exec=/usr/bin/env python3 -m snappy.app" "Exec=SnapPy"
''
@@ -117,6 +130,25 @@ buildPythonPackage rec {
runHook postCheck
'';
passthru.tests.sage =
let
sage' = sage.override {
extraPythonPackages = ps: [ ps.snappy ];
requireSageTests = false;
};
in
runCommand "snappy-sage-tests"
{
nativeBuildInputs = [
sage'
writableTmpDirAsHomeHook
];
}
''
sage -python -m snappy.test --skip-gui
touch $out
'';
meta = {
description = "Studying the topology and geometry of 3-manifolds, with a focus on hyperbolic structures";
changelog = "https://snappy.computop.org/news.html";