about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/python/tests.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/tests.nix')
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/tests.nix35
1 files changed, 34 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/tests.nix b/nixpkgs/pkgs/development/interpreters/python/tests.nix
index cfba04da9380..872123338f8c 100644
--- a/nixpkgs/pkgs/development/interpreters/python/tests.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/tests.nix
@@ -121,4 +121,37 @@ let
     # in assert myPackages.foobar == myPackages.numpy; myPackages.python.withPackages(ps: with ps; [ foobar ]);
   };
 
-in lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform ) (environmentTests // integrationTests // overrideTests)
+  condaTests = let
+    requests = callPackage ({
+        autoPatchelfHook,
+        fetchurl,
+        pythonCondaPackages,
+      }:
+      python.pkgs.buildPythonPackage {
+        pname = "requests";
+        version = "2.24.0";
+        format = "other";
+        src = fetchurl {
+          url = "https://repo.anaconda.com/pkgs/main/noarch/requests-2.24.0-py_0.tar.bz2";
+          sha256 = "02qzaf6gwsqbcs69pix1fnjxzgnngwzvrsy65h1d521g750mjvvp";
+        };
+        nativeBuildInputs = [ autoPatchelfHook ] ++ (with python.pkgs; [
+          condaUnpackHook condaInstallHook
+        ]);
+        buildInputs = [
+          pythonCondaPackages.condaPatchelfLibs
+        ];
+        propagatedBuildInputs = with python.pkgs; [
+          chardet idna urllib3 certifi
+        ];
+      }
+    ) {};
+    pythonWithRequests = requests.pythonModule.withPackages (ps: [ requests ]);
+    in
+    {
+      condaExamplePackage = runCommand "import-requests" {} ''
+        ${pythonWithRequests.interpreter} -c "import requests" > $out
+      '';
+    };
+
+in lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform ) (environmentTests // integrationTests // overrideTests // condaTests)