about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/graphics/freecad/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/graphics/freecad/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/graphics/freecad/default.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/graphics/freecad/default.nix b/nixpkgs/pkgs/applications/graphics/freecad/default.nix
index 76b2a38320d8..857365cd66d5 100644
--- a/nixpkgs/pkgs/applications/graphics/freecad/default.nix
+++ b/nixpkgs/pkgs/applications/graphics/freecad/default.nix
@@ -9,6 +9,7 @@
 , boost
 , coin3d
 , eigen
+, freecad  # for passthru.tests
 , gfortran
 , gts
 , hdf5
@@ -35,6 +36,7 @@
 , qtwebengine
 , qtx11extras
 , qtxmlpatterns
+, runCommand  # for passthru.tests
 , scipy
 , shiboken2
 , soqt
@@ -147,6 +149,21 @@ stdenv.mkDerivation (finalAttrs: {
     ln -s $out/bin/FreeCADCmd $out/bin/freecadcmd
   '';
 
+  passthru.tests = {
+    # Check that things such as argument parsing still work correctly with
+    # the above PYTHONPATH patch. Previously the patch used above changed
+    # the `PyConfig_InitIsolatedConfig` to `PyConfig_InitPythonConfig`,
+    # which caused the built-in interpreter to attempt (and fail) to doubly
+    # parse argv. This should catch if that ever regresses and also ensures
+    # that PYTHONPATH is still respected enough for the FreeCAD console to
+    # successfully run and check that it was included in `sys.path`.
+    python-path = runCommand "freecad-test-console" {
+      nativeBuildInputs = [ freecad ];
+    } ''
+      HOME="$(mktemp -d)" PYTHONPATH="$(pwd)/test" FreeCADCmd --log-file $out -c "if not '$(pwd)/test' in sys.path: sys.exit(1)" </dev/null
+    '';
+  };
+
   meta = {
     homepage = "https://www.freecad.org";
     description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";