1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, poetry-core
6, pytest
7, pythonOlder
8}:
9
10buildPythonPackage rec {
11 pname = "pytest-socket";
12 version = "0.4.0";
13 disabled = pythonOlder "3.6";
14 format = "pyproject";
15
16 src = fetchFromGitHub {
17 owner = "miketheman";
18 repo = pname;
19 rev = version;
20 sha256 = "sha256-cFYtJqZ/RjFbn9XlEy6ffxZ2djisajQAwjV/YR2f59Q=";
21 };
22
23 nativeBuildInputs = [
24 poetry-core
25 ];
26
27 buildInputs = [
28 pytest
29 ];
30
31 checkInputs = [
32 pytest
33 ];
34
35 patches = [
36 # Switch to poetry-core, https://github.com/miketheman/pytest-socket/pull/74
37 (fetchpatch {
38 name = "switch-to-poetry-core.patch";
39 url = "https://github.com/miketheman/pytest-socket/commit/32519170e656e731d24b81770a170333d3efa6a8.patch";
40 sha256 = "19ksgx77rsa6ijcbml74alwc5052mdqr4rmvqhlzvfcvv3676ig2";
41 })
42 ];
43
44 # pytest-socket require network for majority of tests
45 doCheck = false;
46
47 pythonImportsCheck = [ "pytest_socket" ];
48
49 meta = with lib; {
50 description = "Pytest Plugin to disable socket calls during tests";
51 homepage = "https://github.com/miketheman/pytest-socket";
52 license = licenses.mit;
53 maintainers = with maintainers; [ costrouc ];
54 };
55}