From c2cb457ebf80734a7e46ead1d0204e53b358338f Mon Sep 17 00:00:00 2001 From: "Noah D. Brenowitz" Date: Thu, 18 Mar 2021 00:06:36 -0700 Subject: [PATCH 1/4] python37Packages.httplib: disable tests on darwin Most of the tests were failing on Mac OS, and tests were only recently enabled for this package. --- pkgs/development/python-modules/httplib2/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/httplib2/default.nix b/pkgs/development/python-modules/httplib2/default.nix index ce3b3aa1f671..25c227c614e5 100644 --- a/pkgs/development/python-modules/httplib2/default.nix +++ b/pkgs/development/python-modules/httplib2/default.nix @@ -1,4 +1,5 @@ -{ lib +{ stdenv +, lib , buildPythonPackage , fetchFromGitHub , isPy27 @@ -39,8 +40,10 @@ buildPythonPackage rec { pytestCheckHook ]; - # Don't run tests for Python 2.7 - doCheck = !isPy27; + # Don't run tests for Python 2.7 or Darwin + # Nearly 50% of the test suite requires local network access + # which isn't allowed on sandboxed Darwin builds + doCheck = !(isPy27 || stdenv.isDarwin); pytestFlagsArray = [ "--ignore python2" ]; pythonImportsCheck = [ "httplib2" ]; From db242e168182ce6ddb79aafc06a8b68961ae6b60 Mon Sep 17 00:00:00 2001 From: "Noah D. Brenowitz" Date: Thu, 18 Mar 2021 00:08:32 -0700 Subject: [PATCH 2/4] python37Packages.google-auth: disable network tests This disables some tests that using a mocked webserver. --- .../python-modules/google-auth/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/google-auth/default.nix b/pkgs/development/python-modules/google-auth/default.nix index d583de9c074b..39dabef3acec 100644 --- a/pkgs/development/python-modules/google-auth/default.nix +++ b/pkgs/development/python-modules/google-auth/default.nix @@ -1,4 +1,5 @@ -{ lib +{ stdenv +, lib , buildPythonPackage , fetchpatch , fetchPypi @@ -41,6 +42,14 @@ buildPythonPackage rec { "google.oauth2" ]; + disabledTests = lib.optionals stdenv.isDarwin [ + "test_request_with_timeout_success" + "test_request_with_timeout_failure" + "test_request_headers" + "test_request_error" + "test_request_basic" + ]; + meta = with lib; { description = "Google Auth Python Library"; longDescription = '' From 1e48ad0403f20f73c67dccb782aff69c532d3d50 Mon Sep 17 00:00:00 2001 From: "Noah D. Brenowitz" Date: Thu, 18 Mar 2021 00:10:01 -0700 Subject: [PATCH 3/4] python37Packages.google-auth-oauthlib: disable webserver tests These tests fail in a sandboxed build on mac --- .../python-modules/google-auth-oauthlib/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/google-auth-oauthlib/default.nix b/pkgs/development/python-modules/google-auth-oauthlib/default.nix index 7fa7200fbbe5..c350b9b27c4f 100644 --- a/pkgs/development/python-modules/google-auth-oauthlib/default.nix +++ b/pkgs/development/python-modules/google-auth-oauthlib/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , buildPythonPackage , fetchPypi , click @@ -28,6 +29,8 @@ buildPythonPackage rec { pytestCheckHook ]; + disabledTests = lib.optionals stdenv.isDarwin [ "test_run_local_server" ]; + meta = with lib; { description = "Google Authentication Library: oauthlib integration"; homepage = "https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib"; From 5542995561a2c9bcf467f2d55915e1078b286d2b Mon Sep 17 00:00:00 2001 From: "Noah D. Brenowitz" Date: Mon, 15 Mar 2021 19:37:50 -0700 Subject: [PATCH 4/4] python37Packages.tensorflow-bin_2: soften additional versions This package was broken on mac with some wildcarding issues. Some more constraints in the tensorflow wheel needed to be relaxed. --- .../python-modules/tensorflow/bin.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix index ef6d4f45ef9b..7b9cbf1f9900 100644 --- a/pkgs/development/python-modules/tensorflow/bin.nix +++ b/pkgs/development/python-modules/tensorflow/bin.nix @@ -96,10 +96,19 @@ in buildPythonPackage { # Unpack the wheel file. wheel unpack --dest unpacked ./*.whl - # Tensorflow has a hard dependency on gast==0.2.2, but we relax it to - # gast==0.3.2. - substituteInPlace ./unpacked/tensorflow*/tensorflow_core/tools/pip_package/setup.py --replace "gast == 0.2.2" "gast == 0.3.2" - substituteInPlace ./unpacked/tensorflow*/tensorflow_*.dist-info/METADATA --replace "gast (==0.2.2)" "gast (==0.3.2)" + # Tensorflow wheels tightly constrain the versions of gast, tensorflow-estimator and scipy. + # This code relaxes these requirements: + substituteInPlace ./unpacked/tensorflow*/tensorflow_core/tools/pip_package/setup.py \ + --replace "tensorflow_estimator >= 2.1.0rc0, < 2.2.0" "tensorflow_estimator" \ + --replace "tensorboard >= 2.1.0, < 2.2.0" "tensorboard" \ + --replace "gast == 0.2.2" "gast" \ + --replace "scipy == 1.2.2" "scipy" + + substituteInPlace ./unpacked/tensorflow*/tensorflow*.dist-info/METADATA \ + --replace "gast (==0.2.2)" "gast" \ + --replace "tensorflow-estimator (<2.2.0,>=2.1.0rc0)" "tensorflow_estimator" \ + --replace "tensorboard (<2.2.0,>=2.1.0)" "tensorboard" \ + --replace "scipy (==1.4.1)" "scipy" # Pack the wheel file back up. wheel pack ./unpacked/tensorflow*