Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.03 1.9 kB view raw
1{ stdenv 2, buildPythonPackage 3, fetchPypi 4, openssl 5, cryptography 6, pyasn1 7, idna 8, pytest 9, pretend 10, flaky 11, glibcLocales 12}: 13 14with stdenv.lib; 15 16 17let 18 # https://github.com/pyca/pyopenssl/issues/791 19 # These tests, we disable in the case that libressl is passed in as openssl. 20 failingLibresslTests = [ 21 "test_op_no_compression" 22 "test_npn_advertise_error" 23 "test_npn_select_error" 24 "test_npn_client_fail" 25 "test_npn_success" 26 "test_use_certificate_chain_file_unicode" 27 "test_use_certificate_chain_file_bytes" 28 "test_add_extra_chain_cert" 29 "test_set_session_id_fail" 30 "test_verify_with_revoked" 31 "test_set_notAfter" 32 "test_set_notBefore" 33 ]; 34 35 disabledTests = [ 36 # https://github.com/pyca/pyopenssl/issues/692 37 # These tests, we disable always. 38 "test_set_default_verify_paths" 39 "test_fallback_default_verify_paths" 40 ] ++ (optionals (hasPrefix "libressl" openssl.meta.name) failingLibresslTests); 41 42 # Compose the final string expression, including the "-k" and the single quotes. 43 testExpression = optionalString (disabledTests != []) 44 "-k 'not ${concatStringsSep " and not " disabledTests}'"; 45 46in 47 48 49buildPythonPackage rec { 50 pname = "pyOpenSSL"; 51 version = "19.0.0"; 52 53 src = fetchPypi { 54 inherit pname version; 55 sha256 = "aeca66338f6de19d1aa46ed634c3b9ae519a64b458f8468aec688e7e3c20f200"; 56 }; 57 58 outputs = [ "out" "dev" ]; 59 60 checkPhase = '' 61 runHook preCheck 62 export LANG="en_US.UTF-8" 63 py.test tests ${testExpression} 64 runHook postCheck 65 ''; 66 67 # Seems to fail unpredictably on Darwin. See http://hydra.nixos.org/build/49877419/nixlog/1 68 # for one example, but I've also seen ContextTests.test_set_verify_callback_exception fail. 69 doCheck = !stdenv.isDarwin; 70 71 nativeBuildInputs = [ openssl ]; 72 propagatedBuildInputs = [ cryptography pyasn1 idna ]; 73 74 checkInputs = [ pytest pretend flaky glibcLocales ]; 75}