about summary refs log tree commit diff
path: root/pkgs/development/python-modules/mitmproxy
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2021-02-22 13:20:42 +0100
committerFabian Affolter <mail@fabian-affolter.ch>2021-02-22 13:20:42 +0100
commitff770828bab9c7689c9e0badaa81975fccc3bc87 (patch)
tree116f7e170a0d289955c31d4bd93e83d9891b5346 /pkgs/development/python-modules/mitmproxy
parentb5217c5d2a1425d1ff1304047856a60416b1a1d2 (diff)
python3Packages.mitmproxy: adjust requirement and update check part
Diffstat (limited to 'pkgs/development/python-modules/mitmproxy')
-rw-r--r--pkgs/development/python-modules/mitmproxy/default.nix73
1 files changed, 41 insertions, 32 deletions
diff --git a/pkgs/development/python-modules/mitmproxy/default.nix b/pkgs/development/python-modules/mitmproxy/default.nix
index 6dfac82240537..e9c12548269f3 100644
--- a/pkgs/development/python-modules/mitmproxy/default.nix
+++ b/pkgs/development/python-modules/mitmproxy/default.nix
@@ -1,21 +1,25 @@
-{ lib, stdenv
+{ lib
+, stdenv
 , fetchFromGitHub
 , buildPythonPackage
-, isPy27
-, fetchpatch
-# Mitmproxy requirements
+, pythonOlder
+  # Mitmproxy requirements
+, asgiref
 , blinker
 , brotli
 , certifi
 , click
 , cryptography
 , flask
+, h11
 , h2
 , hyperframe
 , kaitaistruct
 , ldap3
+, msgpack
 , passlib
 , protobuf
+, publicsuffix2
 , pyasn1
 , pyopenssl
 , pyparsing
@@ -26,19 +30,17 @@
 , tornado
 , urwid
 , wsproto
-, publicsuffix2
 , zstandard
-# Additional check requirements
+  # Additional check requirements
 , beautifulsoup4
 , glibcLocales
-, pytest
-, requests
-, asynctest
+, hypothesis
 , parver
 , pytest-asyncio
-, hypothesis
-, asgiref
-, msgpack
+, pytest-timeout
+, pytest-xdist
+, pytestCheckHook
+, requests
 }:
 
 buildPythonPackage rec {
@@ -47,24 +49,12 @@ buildPythonPackage rec {
   disabled = pythonOlder "3.8";
 
   src = fetchFromGitHub {
-    owner  = pname;
-    repo   = pname;
-    rev    = "v${version}";
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
     sha256 = "sha256-FyIZKFQtf6qvwo4+NzPa/KOmBCcdGJ3jCqxz26+S2e4=";
   };
 
-  postPatch = ''
-    # remove dependency constraints
-    sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?\( \?, \?!=\([0-9]\.\?\)\+\)\?//' -i setup.py
-  '';
-
-  doCheck = (!stdenv.isDarwin);
-
-  checkPhase = ''
-    export HOME=$(mktemp -d)
-    pytest -k 'not test_get_version' # expects a Git repository
-  '';
-
   propagatedBuildInputs = [
     setuptools
     # setup.py
@@ -75,6 +65,7 @@ buildPythonPackage rec {
     click
     cryptography
     flask
+    h11
     h2
     hyperframe
     kaitaistruct
@@ -96,21 +87,39 @@ buildPythonPackage rec {
   ];
 
   checkInputs = [
-    asynctest
     beautifulsoup4
-    flask
     glibcLocales
     hypothesis
     parver
-    pytest
     pytest-asyncio
+    pytest-timeout
+    pytest-xdist
+    pytestCheckHook
     requests
   ];
 
+  doCheck = !stdenv.isDarwin;
+
+  postPatch = ''
+    # remove dependency constraints
+    sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?\( \?, \?!=\([0-9]\.\?\)\+\)\?//' -i setup.py
+  '';
+
+  preCheck = ''
+    export HOME=$(mktemp -d)
+  '';
+
+  disabledTests = [
+    # Tests require a git repository
+    "test_get_version"
+  ];
+
+  pythonImportsCheck = [ "mitmproxy" ];
+
   meta = with lib; {
     description = "Man-in-the-middle proxy";
-    homepage    = "https://mitmproxy.org/";
-    license     = licenses.mit;
+    homepage = "https://mitmproxy.org/";
+    license = licenses.mit;
     maintainers = with maintainers; [ fpletz kamilchm ];
   };
 }