2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2021-12-26 17:43:05 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-06-28 23:13:55 +00:00
|
|
|
, fetchFromGitHub
|
2022-09-09 14:08:57 +00:00
|
|
|
, unittestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pythonOlder
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "websockets";
|
2022-12-28 21:21:41 +00:00
|
|
|
version = "10.4";
|
2021-12-26 17:43:05 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aaugustin";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-12-28 21:21:41 +00:00
|
|
|
hash = "sha256-IylvnaS8cHatA+WMc5uY9E+l+52INqOMITU1VJPO2xY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
patchPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
# Disable all tests that need to terminate within a predetermined amount of
|
|
|
|
# time. This is nondeterministic.
|
2020-09-25 04:45:31 +00:00
|
|
|
sed -i 's/with self.assertCompletesWithin.*:/if True:/' \
|
2021-06-28 23:13:55 +00:00
|
|
|
tests/legacy/test_protocol.py
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
# Disables tests relying on tight timeouts to avoid failures like:
|
|
|
|
# File "/build/source/tests/legacy/test_protocol.py", line 1270, in test_keepalive_ping_with_no_ping_timeout
|
|
|
|
# ping_1_again, ping_2 = tuple(self.protocol.pings)
|
|
|
|
# ValueError: too many values to unpack (expected 2)
|
|
|
|
for t in \
|
|
|
|
test_keepalive_ping_stops_when_connection_closing \
|
|
|
|
test_keepalive_ping_does_not_crash_when_connection_lost \
|
|
|
|
test_keepalive_ping \
|
|
|
|
test_keepalive_ping_not_acknowledged_closes_connection \
|
|
|
|
test_keepalive_ping_with_no_ping_timeout \
|
|
|
|
; do
|
|
|
|
sed -i "s/def $t(/def skip_$t(/" tests/legacy/test_protocol.py
|
|
|
|
done
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-12-28 21:21:41 +00:00
|
|
|
unittestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
# Tests fail on Darwin with `OSError: AF_UNIX path too long`
|
|
|
|
doCheck = !stdenv.isDarwin;
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"websockets"
|
|
|
|
];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "WebSocket implementation in Python";
|
|
|
|
homepage = "https://websockets.readthedocs.io/";
|
2022-12-28 21:21:41 +00:00
|
|
|
changelog = "https://github.com/aaugustin/websockets/blob/${version}/docs/project/changelog.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
2021-06-28 23:13:55 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|