From 7cea8833ebe5cdbb18f51c7c0c2bcd5d5bbbed85 Mon Sep 17 00:00:00 2001
From: IvarWithoutBones <ivar.scholten@protonmail.com>
Date: Mon, 26 Oct 2020 14:04:02 +0100
Subject: [PATCH] pythonPackages.myfitnesspal: fix build

---
 .../python-modules/myfitnesspal/default.nix     | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/python-modules/myfitnesspal/default.nix b/pkgs/development/python-modules/myfitnesspal/default.nix
index 53e5f825344..0638ce5d1ee 100644
--- a/pkgs/development/python-modules/myfitnesspal/default.nix
+++ b/pkgs/development/python-modules/myfitnesspal/default.nix
@@ -1,6 +1,9 @@
 { lib, fetchPypi, buildPythonPackage
-, blessed, keyring, keyrings-alt, lxml, measurement, python-dateutil, requests, six
-, mock, nose }:
+, blessed, keyring, keyrings-alt, lxml, measurement, python-dateutil, requests, six, rich
+, pytestCheckHook, mock, nose }:
+
+# TODO: Define this package in "all-packages.nix" using "toPythonApplication".
+# This currently errors out, complaining about not being able to find "etree" from "lxml" even though "lxml" is defined in "propagatedBuildInputs".
 
 buildPythonPackage rec {
   pname = "myfitnesspal";
@@ -11,14 +14,18 @@ buildPythonPackage rec {
     sha256 = "c2275e91c794a3569a76c47c78cf2ff04d7f569a98558227e899ead7b30af0d6";
   };
 
-  # Remove overly restrictive version constraints on keyring and keyrings.alt
+  # Remove overly restrictive version constraints
   postPatch = ''
     sed -i 's/keyring>=.*/keyring/' requirements.txt
     sed -i 's/keyrings.alt>=.*/keyrings.alt/' requirements.txt
+    sed -i 's/rich>=.*/rich/' requirements.txt
   '';
 
-  checkInputs = [ mock nose ];
-  propagatedBuildInputs = [ blessed keyring keyrings-alt lxml measurement python-dateutil requests six ];
+  propagatedBuildInputs = [ blessed keyring keyrings-alt lxml measurement python-dateutil requests six rich ];
+
+  # Integration tests require an account to be set
+  disabledTests = [ "test_integration" ];
+  checkInputs = [ pytestCheckHook mock nose ];
 
   meta = with lib; {
     description = "Access your meal tracking data stored in MyFitnessPal programatically";