Package: src:python-polyfactory
Version: 2.20.0-1
Severity: serious
Tags: ftbfs trixie sid

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:

--------------------------------------------------------------------------------
[...]
 debian/rules clean
dh clean --buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
   dh_autoreconf_clean -O--buildsystem=pybuild
   debian/rules override_dh_clean
make[1]: Entering directory '/<<PKGBUILDDIR>>'
rm -rf .mypy_cache .pytest_cache debian/.cache
dh_clean
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
 debian/rules binary
dh binary --buildsystem=pybuild
   dh_update_autotools_config -O--buildsystem=pybuild
   dh_autoreconf -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
   dh_auto_build -O--buildsystem=pybuild
I: pybuild plugin_pyproject:129: Building wheel for python3.13 with "build" 
module
I: pybuild base:311: python3.13 -m build --skip-dependency-check --no-isolation 
--wheel --outdir /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory  
* Building wheel...
Successfully built polyfactory-2.20.0-py3-none-any.whl
I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.13 with 
"installer" module
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:311: cd 
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build; python3.13 -m pytest 
--ignore tests/test_beanie_factory.py -k 'not 
test_optional_url_field_parsed_correctly and not test_type_property_parsing '
============================= test session starts ==============================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build
configfile: pyproject.toml
plugins: Faker-33.3.1, hypothesis-6.127.4, asyncio-0.25.1, typeguard-4.4.2, 
anyio-4.8.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 824 items / 15 deselected / 1 skipped / 809 selected

tests/constraints/test_byte_constraints.py ...                           [  0%]
tests/constraints/test_date_constraints.py ....                          [  0%]
tests/constraints/test_decimal_constraints.py ...................        [  3%]
tests/constraints/test_float_constraints.py ..........s                  [  4%]
tests/constraints/test_frozen_set_constraints.py ....................... [  7%]
...........................................................              [ 14%]
tests/constraints/test_get_field_value_constraints.py ...........        [ 16%]
tests/constraints/test_int_constraints.py .............                  [ 17%]
tests/constraints/test_list_constraints.py ............................. [ 21%]
......................................................                   [ 27%]
tests/constraints/test_mapping_constraints.py ..                         [ 28%]
tests/constraints/test_set_constraints.py .............................. [ 31%]
....................................................                     [ 38%]
tests/constraints/test_string_constraints.py .....                       [ 38%]
tests/sqlalchemy_factory/test_association_proxy.py ..                    [ 39%]
tests/sqlalchemy_factory/test_sqlalchemy_factory_common.py ............. [ 40%]
................................                                         [ 44%]
tests/sqlalchemy_factory/test_sqlalchemy_factory_v2.py ................. [ 46%]
...                                                                      [ 47%]
tests/test_attrs_factory.py .................                            [ 49%]
tests/test_auto_registration.py ....                                     [ 49%]
tests/test_base_factories.py ......                                      [ 50%]
tests/test_build.py .....                                                [ 51%]
tests/test_collection_extender.py .....................                  [ 53%]
tests/test_collection_length.py ........................................ [ 58%]
.......................................                                  [ 63%]
tests/test_complex_types.py .........                                    [ 64%]
tests/test_data_parsing.py ......                                        [ 65%]
tests/test_dataclass_factory.py ..................                       [ 67%]
tests/test_dicts.py .s                                                   [ 67%]
tests/test_factory_configuration.py ..                                   [ 68%]
tests/test_factory_fields.py ...............                             [ 69%]
tests/test_factory_subclassing.py ....                                   [ 70%]
tests/test_faker_customization.py .                                      [ 70%]
tests/test_generics.py ....                                              [ 71%]
tests/test_msgspec_factory.py .......................                    [ 73%]
tests/test_new_types.py ..sF                                             [ 74%]
tests/test_number_generation.py ..........                               [ 75%]
tests/test_optional_model_field_inference.py .....s.............         [ 77%]
tests/test_options_validation.py .....                                   [ 78%]
tests/test_passing_build_args_to_child_factories.py .......              [ 79%]
tests/test_persistence_handlers.py ....                                  [ 79%]
tests/test_provider_map.py ....                                          [ 80%]
tests/test_pydantic_factory.py s....................s.s...s...........ss [ 85%]
s.....                                                                   [ 86%]
tests/test_pydantic_v1_v2.py ......                                      [ 87%]
tests/test_pytest_plugin.py .......                                      [ 87%]
tests/test_random_configuration.py ...............                       [ 89%]
tests/test_random_seed.py ...                                            [ 90%]
tests/test_recursive_models.py ....                                      [ 90%]
tests/test_regex_factory.py ..........................................   [ 95%]
tests/test_type_coverage_generation.py .......s.............             [ 98%]
tests/test_typeddict_factory.py ...                                      [ 98%]
tests/test_utils.py ......s                                              [ 99%]
tests/utils/test_deprecation.py .                                        [ 99%]
tests/utils/test_frozendict.py ..                                        [100%]

=================================== FAILURES ===================================
_______________________________ test_type_alias ________________________________

create_module = <function create_module.<locals>.wrapped at 0x7fb8401f4f40>

    @pytest.mark.skipif(sys.version_info < (3, 12), reason="3.12 only syntax")
    def test_type_alias(create_module: Callable[[str], ModuleType]) -> None:
        module = create_module(
            """
    from typing import Literal
    from dataclasses import dataclass
    
    
    type LiteralAlias = Literal["a", "b"]
    
    
    @dataclass
    class A:
        field: LiteralAlias
    """,
        )
    
        factory = DataclassFactory.create_factory(module.A)
>       result = factory.build()

tests/test_new_types.py:164: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
polyfactory/factories/base.py:1130: in build
    return cast("T", cls.__model__(**cls.process_kwargs(**kwargs)))
polyfactory/factories/base.py:1057: in process_kwargs
    field_result = cls.get_field_value(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'abc.AFactory'>
field_meta = <polyfactory.field_meta.FieldMeta object at 0x7fb840266c00>
field_build_parameters = None
build_context = {'seen_models': {<class 'fkesholunk.A'>}}

    @classmethod
    def get_field_value(  # noqa: C901, PLR0911, PLR0912
        cls,
        field_meta: FieldMeta,
        field_build_parameters: Any | None = None,
        build_context: BuildContext | None = None,
    ) -> Any:
        """Return a field value on the subclass if existing, otherwise returns 
a mock value.
    
        :param field_meta: FieldMeta instance.
        :param field_build_parameters: Any build parameters passed to the 
factory as kwarg values.
        :param build_context: BuildContext data for current build.
    
        :returns: An arbitrary value.
    
        """
        build_context = cls._get_build_context(build_context)
        if cls.is_ignored_type(field_meta.annotation):
            return None
    
        if field_build_parameters is None and 
cls.should_set_none_value(field_meta=field_meta):
            return None
    
        unwrapped_annotation = unwrap_annotation(field_meta.annotation, 
random=cls.__random__)
    
        if is_literal(annotation=unwrapped_annotation) and (literal_args := 
get_args(unwrapped_annotation)):
            return cls.__random__.choice(literal_args)
    
        if isinstance(unwrapped_annotation, EnumMeta):
            return cls.__random__.choice(list(unwrapped_annotation))
    
        if field_meta.constraints:
            return cls.get_constrained_field_value(
                annotation=unwrapped_annotation,
                field_meta=field_meta,
                field_build_parameters=field_build_parameters,
                build_context=build_context,
            )
    
        if is_union(field_meta.annotation) and field_meta.children:
            seen_models = build_context["seen_models"]
            children = [child for child in field_meta.children if 
child.annotation not in seen_models]
    
            # `None` is removed from the children when creating FieldMeta so 
when `children`
            # is empty, it must mean that the field meta is an optional type.
            if not children:
                return None
    
            return cls.get_field_value(cls.__random__.choice(children), 
field_build_parameters, build_context)
    
        if BaseFactory.is_factory_type(annotation=unwrapped_annotation):
            if not field_build_parameters and unwrapped_annotation in 
build_context["seen_models"]:
                return None if is_optional(field_meta.annotation) else Null
    
            return cls._get_or_create_factory(model=unwrapped_annotation).build(
                _build_context=build_context,
                **(field_build_parameters if isinstance(field_build_parameters, 
Mapping) else {}),
            )
    
        if BaseFactory.is_batch_factory_type(annotation=unwrapped_annotation):
            factory = cls._get_or_create_factory(model=field_meta.type_args[0])
            if isinstance(field_build_parameters, Sequence):
                return [
                    factory.build(_build_context=build_context, 
**field_parameters)
                    for field_parameters in field_build_parameters
                ]
    
            if field_meta.type_args[0] in build_context["seen_models"]:
                return []
    
            if not cls.__randomize_collection_length__:
                return [factory.build(_build_context=build_context)]
    
            batch_size = cls.__random__.randint(cls.__min_collection_length__, 
cls.__max_collection_length__)
            return factory.batch(size=batch_size, _build_context=build_context)
    
        if (origin := get_type_origin(unwrapped_annotation)) and 
is_safe_subclass(origin, Collection):
            collection_type = get_collection_type(unwrapped_annotation)
            is_fixed_length = collection_type is tuple and (
                not field_meta.children or field_meta.children[-1].annotation 
!= Ellipsis
            )
            if cls.__randomize_collection_length__ and not is_fixed_length:
                if collection_type is not dict:
                    return handle_constrained_collection(
                        collection_type=collection_type,  # type: 
ignore[type-var]
                        factory=cls,
                        item_type=Any,
                        field_meta=field_meta.children[0] if 
field_meta.children else field_meta,
                        min_items=cls.__min_collection_length__,
                        max_items=cls.__max_collection_length__,
                        field_build_parameters=field_build_parameters,
                        build_context=build_context,
                    )
                return handle_constrained_mapping(
                    factory=cls,
                    field_meta=field_meta,
                    min_items=cls.__min_collection_length__,
                    max_items=cls.__max_collection_length__,
                    field_build_parameters=field_build_parameters,
                    build_context=build_context,
                )
    
            return handle_collection_type(
                field_meta,
                origin,
                cls,
                field_build_parameters=field_build_parameters,
                build_context=build_context,
            )
    
        if provider := cls.get_provider_map().get(unwrapped_annotation):
            return provider()
    
        if isinstance(unwrapped_annotation, TypeVar):
            return create_random_string(cls.__random__, min_length=1, 
max_length=10)
    
        if callable(unwrapped_annotation):
            # if value is a callable we can try to naively call it.
            # this will work for callables that do not require any parameters 
passed
            with suppress(Exception):
                return unwrapped_annotation()
    
        msg = (
            f"Unsupported type: {unwrapped_annotation!r} on field 
'{field_meta.name}' from class {cls.__name__}."
            "\n\nEither use 'add_provider', extend the providers map, or add a 
factory function for the field on the model."
        )
    
>       raise ParameterException(
            msg,
        )
E       polyfactory.exceptions.ParameterException: Unsupported type: 
LiteralAlias on field 'field' from class AFactory.
E       
E       Either use 'add_provider', extend the providers map, or add a factory 
function for the field on the model.

polyfactory/factories/base.py:855: ParameterException
=============================== warnings summary ===============================
../../../../../../usr/lib/python3/dist-packages/pydantic/_migration.py:283
  /usr/lib/python3/dist-packages/pydantic/_migration.py:283: UserWarning: 
`pydantic.generics:GenericModel` has been moved to `pydantic.BaseModel`.
    warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')

tests/constraints/test_decimal_constraints.py: 202 warnings
tests/sqlalchemy_factory/test_sqlalchemy_factory_common.py: 1 warning
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/polyfactory/utils/deprecation.py:141:
 DeprecationWarning: Use of deprecated parameter 'minimum'. Deprecated in 
polyfactory 2.19.1. This parameter will be removed in the next major version
    warn_deprecation(

tests/sqlalchemy_factory/test_sqlalchemy_factory_common.py::test_sqlalchemy_custom_type_from_type_decorator[UUID]
tests/sqlalchemy_factory/test_sqlalchemy_factory_common.py::test_sqlalchemy_custom_type_from_type_decorator[None]
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/sqlalchemy_factory/test_sqlalchemy_factory_common.py:355:
 SAWarning: This declarative base already contains a class with the same class 
name and module name as 
tests.sqlalchemy_factory.test_sqlalchemy_factory_common.Model, and will be 
replaced in the string-lookup table.
    class Model(Base):

tests/test_base_factories.py::test_multiple_base_pydantic_factories[False]
tests/test_base_factories.py::test_multiple_base_pydantic_factories[True]
tests/test_complex_types.py::test_raises_for_user_defined_types
tests/test_data_parsing.py::test_class_parsing
tests/test_data_parsing.py::test_class_parsing
tests/test_factory_fields.py::test_use
tests/test_pydantic_factory.py::test_build_instance_by_field_name_with_allow_population_by_field_name_flag
  /usr/lib/python3/dist-packages/pydantic/_internal/_config.py:295: 
PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use 
ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See 
Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
    warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)

tests/test_data_parsing.py::test_class_parsing
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_data_parsing.py:100:
 PydanticDeprecatedSince20: BaseConfig is deprecated. Use the 
`pydantic.ConfigDict` instead. Deprecated in Pydantic V2.0 to be removed in 
V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    class Config(BaseConfig):

tests/test_data_parsing.py::test_class_parsing
tests/test_data_parsing.py::test_class_parsing
  /usr/lib/python3/dist-packages/pydantic/deprecated/config.py:50: 
PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use 
ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See 
Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
    warnings.warn(_config.DEPRECATION_MESSAGE, DeprecationWarning)

tests/test_data_parsing.py::test_class_parsing
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_data_parsing.py:127:
 PydanticDeprecatedSince20: BaseConfig is deprecated. Use the 
`pydantic.ConfigDict` instead. Deprecated in Pydantic V2.0 to be removed in 
V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    class Config(BaseConfig):

tests/test_dicts.py::test_passing_nested_dict
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_dicts.py:26:
 PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` 
instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 
Migration Guide at https://errors.pydantic.dev/2.10/migration/
    assert obj.dict() == {"my_mapping_obj": {"baz": {"val": "bar"}}, 
"my_mapping_str": {"foo": "bar"}}

tests/test_pydantic_factory.py::test_factory_nested_model_collection_construct_coverage
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_pydantic_factory.py:239:
 PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are 
deprecated. You should migrate to Pydantic V2 style `@field_validator` 
validators, see the migration guide for more details. Deprecated in Pydantic 
V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    @validator("foo")

tests/test_pydantic_factory.py::test_factory_use_construct_coverage
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_pydantic_factory.py:271:
 PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are 
deprecated. You should migrate to Pydantic V2 style `@field_validator` 
validators, see the migration guide for more details. Deprecated in Pydantic 
V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    @validator("invalid")

tests/test_pydantic_factory.py::test_factory_use_construct_validator
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_pydantic_factory.py:307:
 PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are 
deprecated. You should migrate to Pydantic V2 style `@field_validator` 
validators, see the migration guide for more details. Deprecated in Pydantic 
V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    @validator("invalid")

tests/test_pydantic_factory.py::test_factory_use_construct_nested_set[FrozenSet]
tests/test_pydantic_factory.py::test_factory_use_construct_nested_set[Set]
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/tests/test_pydantic_factory.py:345:
 PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are 
deprecated. You should migrate to Pydantic V2 style `@field_validator` 
validators, see the migration guide for more details. Deprecated in Pydantic 
V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    @validator("invalid", allow_reuse=True)

tests/test_pydantic_factory.py::test_factory_use_construct_nested_set[FrozenSet]
tests/test_pydantic_factory.py::test_factory_use_construct_nested_set[Set]
  /usr/lib/python3/dist-packages/pydantic/deprecated/class_validators.py:121: 
PydanticDeprecatedSince20: `allow_reuse` is deprecated and will be ignored; it 
should no longer be necessary. Deprecated in Pydantic V2.0 to be removed in 
V3.0. See Pydantic V2 Migration Guide at 
https://errors.pydantic.dev/2.10/migration/
    warn(_ALLOW_REUSE_WARNING_MESSAGE, DeprecationWarning)

tests/test_pydantic_factory.py::test_build_instance_by_field_name_with_allow_population_by_field_name_flag
  /usr/lib/python3/dist-packages/pydantic/_internal/_config.py:345: 
UserWarning: Valid config keys have changed in V2:
  * 'allow_population_by_field_name' has been renamed to 'populate_by_name'
    warnings.warn(message, UserWarning)

tests/test_pytest_plugin.py::test_using_a_fixture_as_field_value
tests/test_pytest_plugin.py::test_using_a_fixture_as_field_value
tests/test_pytest_plugin.py::test_using_a_fixture_as_field_value
tests/test_pytest_plugin.py::test_using_non_fixture_with_the_fixture_field_raises
  
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build/polyfactory/utils/deprecation.py:98:
 DeprecationWarning: Call to deprecated function '__init__'. Deprecated in 
polyfactory 2.20.0. This function will be removed in the next major version. 
Use 'Use factory directly' instead
    warn_deprecation(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_new_types.py::test_type_alias - polyfactory.exceptions.Para...
==== 1 failed, 795 passed, 14 skipped, 15 deselected, 230 warnings in 6.24s ====
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd 
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_polyfactory/build; python3.13 -m pytest 
--ignore tests/test_beanie_factory.py -k 'not 
test_optional_url_field_parsed_correctly and not test_type_property_parsing '
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.13 
returned exit code 13
make: *** [debian/rules:17: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------

The above is just how the build ends and not necessarily the most relevant part.
If required, the full build log is available here:

https://people.debian.org/~sanvila/build-logs/202504/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you could not reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:python-polyfactory, so that this is still
visible in the BTS web page for this package.

Thanks.

Reply via email to