about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyppeteer
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2021-05-24 09:16:48 +0200
committerFabian Affolter <mail@fabian-affolter.ch>2021-05-24 09:16:48 +0200
commitb62d2a5eca05d04ec26351016209ada7baaf281e (patch)
tree549b79dc536918380c036e1b25ad458b1485e376 /pkgs/development/python-modules/pyppeteer
parent2881043be7ed3936a53a3c4cd7e8aae14de93b1a (diff)
python3Packages.pyppeteer: enable tests
Diffstat (limited to 'pkgs/development/python-modules/pyppeteer')
-rw-r--r--pkgs/development/python-modules/pyppeteer/default.nix85
1 files changed, 77 insertions, 8 deletions
diff --git a/pkgs/development/python-modules/pyppeteer/default.nix b/pkgs/development/python-modules/pyppeteer/default.nix
index 13f1794aebe08..6da76a5cdba55 100644
--- a/pkgs/development/python-modules/pyppeteer/default.nix
+++ b/pkgs/development/python-modules/pyppeteer/default.nix
@@ -1,25 +1,94 @@
-{ buildPythonPackage, fetchPypi, lib, urllib3, pyee, tqdm, websockets, appdirs }:
+{ lib
+, appdirs
+, buildPythonPackage
+, fetchFromGitHub
+, fetchpatch
+, poetry-core
+, pyee
+, pytest-xdist
+, pytestCheckHook
+, pythonOlder
+, syncer
+, tqdm
+, urllib3
+, websockets
+}:
 
 buildPythonPackage rec {
   pname = "pyppeteer";
   version = "0.2.5";
+  disabled = pythonOlder "3.6";
+  format = "pyproject";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "c2974be1afa13b17f7ecd120d265d8b8cd324d536a231c3953ca872b68aba4af";
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = version;
+    sha256 = "1hl4rw8j5yiak0d34vx1l1blr8125bscjd8m46a5m8xzm98csjc7";
   };
 
-  # tests want to write to /homeless-shelter
-  doCheck = false;
+  nativeBuildInputs = [
+    poetry-core
+  ];
 
   propagatedBuildInputs = [
     appdirs
-    websockets
-    tqdm
     pyee
+    tqdm
     urllib3
+    websockets
+  ];
+
+  checkInputs = [
+    syncer
+    pytest-xdist
+    pytestCheckHook
   ];
 
+  patches = [
+    # Switch to poetry-core, https://github.com/pyppeteer/pyppeteer/pull/262
+    (fetchpatch {
+      name = "switch-poetry-core.patch";
+      url = "https://github.com/pyppeteer/pyppeteer/commit/e248baebefcf262fd96f261d940e74ed49ba2df9.patch";
+      sha256 = "03g8n35kn2alqki37s0hf2231fk2zkr4nr1x1g2rfrhps9d6fyvw";
+    })
+  ];
+
+  postPatch = ''
+    # https://github.com/pyppeteer/pyppeteer/pull/252
+    substituteInPlace pyproject.toml \
+      --replace 'websockets = "^8.1"' 'websockets = "*"'
+  '';
+
+  disabledTestPaths = [
+    # Requires network access
+    "tests/test_browser.py"
+    "tests/test_browser_context.py"
+    "tests/test_connection.py"
+    "tests/test_coverage.py"
+    "tests/test_dialog.py"
+    "tests/test_element_handle.py"
+    "tests/test_execution_context.py"
+    "tests/test_frame.py"
+    "tests/test_input.py"
+    "tests/test_launcher.py"
+    "tests/test_network.py"
+    "tests/test_page.py"
+    "tests/test_pyppeteer.py"
+    "tests/test_target.py"
+    "tests/test_tracing.py"
+    "tests/test_worker.py"
+  ];
+
+  disabledTests = [
+    # Requires network access
+    "TestScreenShot"
+    "TestBrowserCrash"
+    "TestPDF"
+  ];
+
+  pythonImportsCheck = [ "pyppeteer" ];
+
   meta = {
     description = "Headless chrome/chromium automation library (unofficial port of puppeteer)";
     homepage = "https://github.com/pyppeteer/pyppeteer";