Commit c70b5896 authored by nyanloutre's avatar nyanloutre
Browse files

python3Packages.telethon: 1.37.0 -> 1.40.0

fix tests in new version
parent 756bd89f
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  openssl,
  rsa,
  pyaes,
@@ -14,7 +15,7 @@

buildPythonPackage rec {
  pname = "telethon";
  version = "1.37.0";
  version = "1.40.0";
  pyproject = true;

  disabled = pythonOlder "3.5";
@@ -23,10 +24,26 @@ buildPythonPackage rec {
    owner = "LonamiWebs";
    repo = "Telethon";
    tag = "v${version}";
    hash = "sha256-P7FP+Wqi3dqbBCFpI9aCDvK4k3mWv8076RO6MXg+jFQ=";
    hash = "sha256-y8nMh2dAy5ixATYGjH04FtfpvhO2HU5HRTXBr7Z+Dds=";
  };

  patchPhase = ''
  patches = [
    # https://github.com/LonamiWebs/Telethon/pull/4670
    (fetchpatch {
      url = "https://github.com/LonamiWebs/Telethon/commit/8e2a46568ef9193f5887aea1abf919ac4ca6d31e.patch";
      name = "fix_async_test.patch";
      hash = "sha256-oVpLnO4OxNam/mq945OskVEHkbS5TDSUXk/0xPHVv3I=";
    })
  ]
  ++ lib.optionals (lib.versionOlder version "1.40.1") [
    (fetchpatch {
      url = "https://github.com/LonamiWebs/Telethon/commit/ae9c798e2c3648ff40dee1b3f371f5d66851642e.patch";
      name = "fix_test_messages_test.patch";
      hash = "sha256-8SJm8EE6w7zRQxt1NuTX6KP1MTYPiYO/maJ5tOA2I9w=";
    })
  ];

  postPatch = ''
    substituteInPlace telethon/crypto/libssl.py --replace-fail \
      "ctypes.util.find_library('ssl')" "'${lib.getLib openssl}/lib/libssl.so'"
  '';
@@ -49,16 +66,11 @@ buildPythonPackage rec {
    pytestCheckHook
  ];

  disabledTests = [
    # https://github.com/LonamiWebs/Telethon/issues/4254
    "test_all_methods_present"
    "test_private_get_extension"
  ];

  meta = {
    homepage = "https://github.com/LonamiWebs/Telethon";
    description = "Full-featured Telegram client library for Python 3";
    license = lib.licenses.mit;
    changelog = "https://github.com/LonamiWebs/Telethon/blob/${src.tag}/readthedocs/misc/changelog.rst";
    maintainers = with lib.maintainers; [ nyanloutre ];
  };
}