python3Packages.polyfactory: cleanup, skip failing tests on python>=3.14 (#485890)

This commit is contained in:
kirillrdy
2026-02-01 19:43:00 +00:00
committed by GitHub
3 changed files with 88 additions and 45 deletions
@@ -1,34 +1,42 @@
{
lib,
aiolimiter,
azure-identity,
azure-storage-blob,
buildPythonPackage,
fetchPypi,
pythonAtLeast,
# build-system
hatchling,
uv-dynamic-versioning,
# dependencies
aiolimiter,
httpx,
json-repair,
openai,
polyfactory,
pydantic,
tenacity,
# optional-dependencies
# azure
azure-identity,
azure-storage-blob,
# openai
openai,
tiktoken,
# tests
polyfactory,
pytest-asyncio,
pytest-cov-stub,
pytestCheckHook,
pythonOlder,
tenacity,
tiktoken,
uv-dynamic-versioning,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "fnllm";
version = "0.4.1";
pyproject = true;
disabled = pythonOlder "3.11";
src = fetchPypi {
inherit pname version;
inherit (finalAttrs) pname version;
hash = "sha256-gKdFBpNpG/CDLhKi1wQgZHv+o1pDy5HEqcteLzkXK1A=";
};
@@ -62,7 +70,7 @@ buildPythonPackage rec {
pytest-cov-stub
pytestCheckHook
]
++ lib.concatAttrValues optional-dependencies;
++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies;
pythonImportsCheck = [ "fnllm" ];
@@ -81,6 +89,10 @@ buildPythonPackage rec {
"test_clear"
"test_handles_common_errors"
"test_children"
]
++ lib.optionals (pythonAtLeast "3.14") [
# RuntimeError: There is no current event loop in thread 'MainThread'
"test_call_batch_raises_if_response_length_mismatch"
];
meta = {
@@ -89,4 +101,4 @@ buildPythonPackage rec {
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ fab ];
};
}
})
@@ -2,6 +2,7 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonAtLeast,
# build-system
hatchling,
@@ -31,7 +32,6 @@
prometheus-client,
psutil,
opentelemetry-instrumentation-asgi,
psycopg,
pydantic-extra-types,
pydantic,
email-validator,
@@ -47,6 +47,7 @@
# valkey,
# tests
addBinToPathHook,
httpx-sse,
pytest-asyncio,
pytest-lazy-fixtures,
@@ -59,7 +60,7 @@
versionCheckHook,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "litestar";
version = "2.18.0";
pyproject = true;
@@ -67,7 +68,7 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "litestar-org";
repo = "litestar";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-bqj7tvCNeMEEJKDF3g2beKfd0urbNszrbLdF96JygYk=";
};
@@ -127,6 +128,7 @@ buildPythonPackage rec {
};
nativeCheckInputs = [
addBinToPathHook
httpx-sse
pytest-asyncio
pytest-lazy-fixtures
@@ -144,15 +146,16 @@ buildPythonPackage rec {
__darwinAllowLocalNetworking = true;
preCheck = ''
export PATH=$out/bin:$PATH
'';
enabledTestPaths = [
# Follow GitHub CI
"docs/examples/"
];
pytestFlags = lib.optionals (pythonAtLeast "3.14") [
# UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater.
"-Wignore::UserWarning"
];
disabledTests = [
# StartupError
"test_subprocess_async_client"
@@ -161,10 +164,10 @@ buildPythonPackage rec {
meta = {
description = "Production-ready, Light, Flexible and Extensible ASGI API framework";
homepage = "https://litestar.dev/";
changelog = "https://github.com/litestar-org/litestar/releases/tag/${src.tag}";
changelog = "https://github.com/litestar-org/litestar/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
mainProgram = "litestar";
maintainers = with lib.maintainers; [ bot-wxt1221 ];
platforms = lib.platforms.unix;
};
}
})
@@ -1,22 +1,29 @@
{
buildPythonPackage,
lib,
buildPythonPackage,
fetchFromGitHub,
pythonAtLeast,
# build-system
hatchling,
hypothesis,
faker,
msgspec,
sqlalchemy,
# dependencies
aiosqlite,
typing-extensions,
pymongo,
pytest-asyncio,
pydantic,
pytestCheckHook,
email-validator,
faker,
hypothesis,
msgspec,
pydantic,
pymongo,
sqlalchemy,
typing-extensions,
# tests
pytest-asyncio,
pytestCheckHook,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "polyfactory";
version = "3.2.0";
pyproject = true;
@@ -24,22 +31,22 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "litestar-org";
repo = "polyfactory";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-J/CHf85jomybMp2U9l5kbD5q0MtYlY9hZkjxjS2jXvg=";
};
build-system = [ hatchling ];
dependencies = [
faker
typing-extensions
hypothesis
pydantic
sqlalchemy
msgspec
pymongo
aiosqlite
email-validator
faker
hypothesis
msgspec
pydantic
pymongo
sqlalchemy
typing-extensions
];
nativeCheckInputs = [
@@ -48,14 +55,35 @@ buildPythonPackage rec {
];
disabledTestPaths = [
# Requires unpackaged 'beanie'
"tests/test_beanie_factory.py"
];
enabledTestPaths = [
"tests/test_msgspec_factory.py"
];
disabledTests = [
# Unsupported type: LiteralAlias
"test_type_alias"
# Unsupported type: 'JsonValue' on field '' from class RecursiveTypeModelFactory.
"test_recursive_type_annotation"
]
++ lib.optionals (pythonAtLeast "3.14") [
# AttributeError: 'Foo' object has no attribute 'set_field'
"test_other_basic_types"
# KeyError: 'foo_field'
"test_with_nested_struct"
# AttributeError: 'Foo' object has no attribute 'unset'
"test_msgspec_types"
# Failed: DID NOT RAISE <class 'polyfactory.exceptions.ParameterException'>
"test_datetime_constraints"
# assert <msgspec._core.Field object at 0x7ffff34794c0> == 10
"test_use_default_with_callable_default"
];
pythonImportsCheck = [ "polyfactory" ];
@@ -64,8 +92,8 @@ buildPythonPackage rec {
homepage = "https://polyfactory.litestar.dev/";
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ bot-wxt1221 ];
changelog = "https://github.com/litestar-org/polyfactory/releases/tag/${src.tag}";
changelog = "https://github.com/litestar-org/polyfactory/releases/tag/${finalAttrs.src.tag}";
description = "Simple and powerful factories for mock data generation";
license = lib.licenses.mit;
};
}
})