From 99c80ee729b405c575acf4dfdd2033bb8f9b5568 Mon Sep 17 00:00:00 2001
From: Fabian Affolter <mail@fabian-affolter.ch>
Date: Sat, 29 May 2021 20:17:57 +0200
Subject: [PATCH] python3Packages.flametree: enable tests

---
 .../python-modules/flametree/default.nix      | 34 +++++++++++++++----
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/pkgs/development/python-modules/flametree/default.nix b/pkgs/development/python-modules/flametree/default.nix
index d4cba69afcb0..b4311eeb7cd6 100644
--- a/pkgs/development/python-modules/flametree/default.nix
+++ b/pkgs/development/python-modules/flametree/default.nix
@@ -1,25 +1,45 @@
 { lib
 , buildPythonPackage
-, fetchPypi
+, fetchFromGitHub
+, fontconfig
+, matplotlib
+, pandas
+, pytestCheckHook
+, weasyprint
 }:
 
 buildPythonPackage rec {
   pname = "flametree";
   version = "0.1.11";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "c8eb81dea8c7f8261a2aa03d2bac98b1d21ebceec9c67efaac423f7c1b4fe061";
+  src = fetchFromGitHub {
+    owner = "Edinburgh-Genome-Foundry";
+    repo = "Flametree";
+    rev = "v${version}";
+    sha256 = "1ynrk1ivl1vjiga0ayl8k89vs5il7i0pf9jz2ycn771c47szwk4x";
   };
 
-  # no tests in tarball
-  doCheck = false;
+  checkInputs = [
+    matplotlib
+    pandas
+    pytestCheckHook
+    weasyprint
+  ];
+
+  preCheck = ''
+    export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
+  '';
+
+  disabledTests = [
+    # AssertionError, https://github.com/Edinburgh-Genome-Foundry/Flametree/issues/9
+    "test_weasyprint"
+  ];
 
   pythonImportsCheck = [ "flametree" ];
 
   meta = with lib; {
-    homepage = "https://github.com/Edinburgh-Genome-Foundry/Flametree";
     description = "Python file and zip operations made easy";
+    homepage = "https://github.com/Edinburgh-Genome-Foundry/Flametree";
     license = licenses.mit;
     maintainers = with maintainers; [ prusnak ];
   };