Commit b51053ad authored by lucasew's avatar lucasew
Browse files

python3Packages.orange3: fix test



Signed-off-by: default avatarlucasew <lucas59356@gmail.com>
parent c29c7f5f
Loading
Loading
Loading
Loading
+27 −13
Original line number Diff line number Diff line
{ lib
, stdenv
, baycomp
, bottleneck
, buildPythonPackage
@@ -24,12 +25,15 @@
, orange-canvas-core
, orange-widget-base
, pandas
, pytestCheckHook
, pytest-qt
, pyqtgraph
, pyqtwebengine
, python
, python-louvain
, pythonOlder
, pyyaml
, pip
, qt5
, qtconsole
, recommonmark
@@ -112,6 +116,7 @@ let
      keyrings-alt
      pyyaml
      baycomp
      pip
    ];

    # FIXME: ImportError: cannot import name '_variable' from partially initialized module 'Orange.data' (most likely due to a circular import) (/build/source/Orange/data/__init__.py)
@@ -146,9 +151,9 @@ let

    passthru = {
      updateScript = nix-update-script { };
      tests.unittests = self.overridePythonAttrs (old: {
        pname = "${old.pname}-tests";
        format = "other";
      tests.unittests = stdenv.mkDerivation {
        name = "${self.name}-tests";
        inherit (self) src;

        preCheck = ''
          export HOME=$(mktemp -d)
@@ -160,23 +165,32 @@ let
          cp -r ${self}/${python.sitePackages}/Orange .
          chmod +w -R .

          rm Orange/tests/test_url_reader.py # uses network
          rm Orange/tests/test_ada_boost.py # broken: The 'base_estimator' parameter of AdaBoostRegressor must be an object implementing 'fit' and 'predict' or a str among {'deprecated'}. Got None instead.
        '';
          substituteInPlace Orange/classification/tests/test_xgb_cls.py \
            --replace test_learners mk_test_learners

          substituteInPlace Orange/modelling/tests/test_xgb.py \
            --replace test_learners mk_test_learners

          substituteInPlace Orange/**/tests/*.py \
            --replace test_filename filename_test

          # TODO: debug why orange is crashing on GC, may be a upstream issue
          chmod +x Orange/__init__.py
          echo "import gc; gc.disable()" | tee -a Orange/__init__.py

        checkPhase = ''
          runHook preCheck
          ${python.interpreter} -m unittest -b -v ./Orange/**/test*.py
          runHook postCheck
        '';

        postInstall = "";
        nativeBuildInputs = [ pytestCheckHook pytest-qt ];

        postCheck = ''
          touch $out
        '';

        doBuild = false;
        doInstall = false;

        nativeBuildInputs = [ self ] ++ old.nativeBuildInputs;
      });
        buildInputs = [ self ];
      };
    };

    meta = with lib; {