2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-08-22 07:53:02 +00:00
|
|
|
, fetchpatch
|
|
|
|
, poetry-core
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytest
|
2021-08-22 07:53:02 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest-socket";
|
2021-08-22 07:53:02 +00:00
|
|
|
version = "0.4.0";
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "miketheman";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-08-22 07:53:02 +00:00
|
|
|
sha256 = "sha256-cFYtJqZ/RjFbn9XlEy6ffxZ2djisajQAwjV/YR2f59Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
buildInputs = [
|
2020-04-24 23:36:52 +00:00
|
|
|
pytest
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytest
|
|
|
|
];
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
patches = [
|
|
|
|
# Switch to poetry-core, https://github.com/miketheman/pytest-socket/pull/74
|
|
|
|
(fetchpatch {
|
|
|
|
name = "switch-to-poetry-core.patch";
|
|
|
|
url = "https://github.com/miketheman/pytest-socket/commit/32519170e656e731d24b81770a170333d3efa6a8.patch";
|
|
|
|
sha256 = "19ksgx77rsa6ijcbml74alwc5052mdqr4rmvqhlzvfcvv3676ig2";
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
# pytest-socket require network for majority of tests
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pytest_socket" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Pytest Plugin to disable socket calls during tests";
|
|
|
|
homepage = "https://github.com/miketheman/pytest-socket";
|
|
|
|
license = licenses.mit;
|
2021-08-22 07:53:02 +00:00
|
|
|
maintainers = with maintainers; [ costrouc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|