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
|
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
, pythonOlder
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "websockets";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "10.1";
|
|
|
|
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;
|
2021-12-26 17:43:05 +00:00
|
|
|
sha256 = "sha256-FFaoqxa+TmKJ+P6T7HrwodjbVCir+2qJSfZsoj6deJU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Tests fail on Darwin with `OSError: AF_UNIX path too long`
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
${python.interpreter} -m unittest discover
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
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/";
|
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
|
|
|
};
|
|
|
|
}
|