Unverified Commit dc16cbcf authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

Merge pull request #281994 from fabaff/betterproto-fix

python311Packages.betterproto: disable failing pydantic tests
parents 0cab2770 5499bfee
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -15,23 +15,26 @@
buildPythonPackage rec {
  pname = "aiogithubapi";
  version = "23.11.0";
  format = "pyproject";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "ludeeus";
    repo = pname;
    repo = "aiogithubapi";
    rev = "refs/tags/${version}";
    hash = "sha256-SbpfHKD4QJuCe3QG0GTvsffkuFiGPLEUXOVW9f1gyTI=";
  };

  __darwinAllowLocalNetworking = true;

  postPatch = ''
    # Upstream is releasing with the help of a CI to PyPI, GitHub releases
    # are not in their focus
    substituteInPlace pyproject.toml \
      --replace 'version = "0"' 'version = "${version}"' \
      --replace 'backoff = "^1.10.0"' 'backoff = "*"'
      --replace 'backoff = "^1.10.0"' 'backoff = "*"' \
      --replace 'sigstore = "<2"' 'sigstore = "*"'
  '';

  nativeBuildInputs = [
@@ -55,10 +58,19 @@ buildPythonPackage rec {
    "--asyncio-mode=auto"
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [
    "aiogithubapi"
  ];

  disabledTests = [
    # sigstore.errors.TUFError: Failed to refresh TUF metadata
    "test_sigstore"
  ];

  meta = with lib; {
    description = "Python client for the GitHub API";
    homepage = "https://github.com/ludeeus/aiogithubapi";
+27 −10
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
, pytestCheckHook
, pytest-asyncio
, pytest-mock
, typing-extensions
, tomlkit
, grpcio-tools
}:
@@ -20,21 +21,25 @@
buildPythonPackage rec {
  pname = "betterproto";
  version = "2.0.0b6";
  format = "pyproject";
  disabled = pythonOlder "3.7";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "danielgtaylor";
    repo = "python-betterproto";
    rev = "v.${version}";
    rev = "refs/tags/v.${version}";
    hash = "sha256-ZuVq4WERXsRFUPNNTNp/eisWX1MyI7UtwqEI8X93wYI=";
  };

  nativeBuildInputs = [ poetry-core ];
  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    grpclib
    python-dateutil
    typing-extensions
  ];

  passthru.optional-dependencies.compiler = [
@@ -43,16 +48,18 @@ buildPythonPackage rec {
    isort
  ];

  pythonImportsCheck = [ "betterproto" ];

  nativeCheckInputs = [
    grpcio-tools
    pydantic
    pytestCheckHook
    pytest-asyncio
    pytest-mock
    pytestCheckHook
    tomlkit
    grpcio-tools
  ] ++ passthru.optional-dependencies.compiler;
  ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

  pythonImportsCheck = [
    "betterproto"
  ];

  # The tests require the generation of code before execution. This requires
  # the protoc-gen-python_betterproto script from the package to be on PATH.
@@ -62,14 +69,24 @@ buildPythonPackage rec {
    ${python.interpreter} -m tests.generate
  '';

  disabledTestPaths = [
    # https://github.com/danielgtaylor/python-betterproto/issues/530
    "tests/inputs/oneof/test_oneof.py"
  ];

  disabledTests = [
    "test_pydantic_no_value"
  ];

  meta = with lib; {
    description = "Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC";
    description = "Code generator & library for Protobuf 3 and async gRPC";
    longDescription = ''
      This project aims to provide an improved experience when using Protobuf /
      gRPC in a modern Python environment by making use of modern language
      features and generating readable, understandable, idiomatic Python code.
    '';
    homepage = "https://github.com/danielgtaylor/python-betterproto";
    changelog = "https://github.com/danielgtaylor/python-betterproto/blob/v.${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ nikstur ];
  };
+27 −11
Original line number Diff line number Diff line
{ lib
, appdirs
, buildPythonPackage
, cryptography
, fetchFromGitHub

# build-system
, flit-core

# dependencies
, appdirs
, cryptography
, id
, importlib-resources
, pretend
, pydantic
, pyjwt
, pyopenssl
, pytestCheckHook
, requests
, rich
, securesystemslib
, sigstore-protobuf-specs
, sigstore-rekor-types
, tuf

# tests
, pytestCheckHook
, pythonOlder
}:

buildPythonPackage rec {
@@ -29,10 +25,12 @@ buildPythonPackage rec {
  version = "2.1.0";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "sigstore";
    repo = "sigstore-python";
    rev = "v${version}";
    rev = "refs/tags/v${version}";
    hash = "sha256-WH6Pme8ZbfW5xqBT056eVJ3HZP1D/lAULtyN6k0uMaA=";
  };

@@ -57,17 +55,35 @@ buildPythonPackage rec {
  ];

  nativeCheckInputs = [
    pretend
    pytestCheckHook
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [
    "sigstore"
  ];

  disabledTests = [
    # Tests require network access
    "test_fail_init_url"
    "test_get_identity_token_bad_code"
    "test_identity_proof_claim_lookup"
    "test_init_url"
    "test_production"
    "test_sct_verify_keyring"
    "test_sign_rekor_entry_consistent"
    "test_verification_materials_retrieves_rekor_entry"
    "test_verifier"
  ];

  meta = with lib; {
    description = "A codesigning tool for Python packages";
    homepage = "https://github.com/sigstore/sigstore-python";
    changelog = "https://github.com/sigstore/sigstore-python/blob/${src.rev}/CHANGELOG.md";
    changelog = "https://github.com/sigstore/sigstore-python/blob/${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
  };