-
Notifications
You must be signed in to change notification settings - Fork 285
2.18.2: pytest fails in 3 units #1302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks to me like your failures can be grouped into two categories:
|
I'n using dateutils 0.6.12 and tzdata 2024a.
No I haven't. |
So maybe we can try switching the tests to
Hmm so testing on my machine it looks like |
Let's try #1304 and see if it resolves in the next release. |
Just tested 2.18.3 and none of the units are failing but pytest shows some back traces ========================================================================================= XFAILURES =========================================================================================
_______________________________________________________________________________ test_extra_custom_serializer ________________________________________________________________________________
@pytest.mark.xfail(reason='dataclasses do not serialize extras')
def test_extra_custom_serializer():
@dataclasses.dataclass
class Model:
pass
schema = core_schema.dataclass_schema(
Model,
core_schema.dataclass_args_schema(
'Model',
[],
extra_behavior='allow',
# extras_schema=core_schema.any_schema(
# serialization=core_schema.plain_serializer_function_ser_schema(
# lambda v: v + ' bam!',
# )
# )
),
[],
)
s = SchemaSerializer(schema)
v = SchemaValidator(schema)
m = v.validate_python({'extra': 'extra'})
> assert s.to_python(m) == {'extra': 'extra bam!'}
E AssertionError: assert {} == {'extra': 'extra bam!'}
E
E Right contains 1 more item:
E {'extra': 'extra bam!'}
E Use -v to get more diff
tests/serializers/test_dataclasses.py:194: AssertionError
________________________________________________ test_smart_union_json_string_types_str_first[schema0-12345678-1234-5678-1234-567812345678] _________________________________________________
schema = {'type': 'uuid'}, input_value = '12345678-1234-5678-1234-567812345678'
@pytest.mark.parametrize(
('schema', 'input_value'),
(
pytest.param(
core_schema.uuid_schema(),
'12345678-1234-5678-1234-567812345678',
marks=pytest.mark.xfail(reason='TODO: V3'),
),
(core_schema.date_schema(), '2020-01-01'),
(core_schema.time_schema(), '00:00:00'),
(core_schema.datetime_schema(), '2020-01-01:00:00:00'),
(core_schema.url_schema(), 'https://foo.com'),
(core_schema.multi_host_url_schema(), 'https://bar.com,foo.com'),
),
)
def test_smart_union_json_string_types_str_first(schema: core_schema.CoreSchema, input_value: str):
# As above, but reversed order; str should always win
validator = SchemaValidator(core_schema.union_schema([core_schema.str_schema(), schema]))
> assert validator.validate_json(f'"{input_value}"') == input_value
E assert UUID('12345678-1234-5678-1234-567812345678') == '12345678-1234-5678-1234-567812345678'
E + where UUID('12345678-1234-5678-1234-567812345678') = <built-in method validate_json of pydantic_core._pydantic_core.SchemaValidator object at 0x5612ce473f40>('"12345678-1234-5678-1234-567812345678"')
E + where <built-in method validate_json of pydantic_core._pydantic_core.SchemaValidator object at 0x5612ce473f40> = SchemaValidator(title="union[str,uuid]", validator=Union(\n UnionValidator {\n mode: Smart,\n choices: [...stom_error: None,\n strict: false,\n name: "union[str,uuid]",\n },\n), definitions=[], cache_strings=True).validate_json
tests/validators/test_union.py:572: AssertionError
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/serializers/test_any.py:93: Path output different on windows
SKIPPED [1] tests/serializers/test_timedelta.py:46: pandas not installed
SKIPPED [1] tests/test_build.py:64: unconditional skip
SKIPPED [1] tests/test_docstrings.py:15: Only on linux and macos
SKIPPED [1] tests/test_docstrings.py:28: Only on linux and macos
SKIPPED [1] tests/test_errors.py:514: This is the modern version used post 3.10.
SKIPPED [53] tests/conftest.py:47: JSON skipping ArgsKwargs
SKIPPED [1] tests/validators/test_timedelta.py:278: pandas not installed
XFAIL tests/serializers/test_dataclasses.py::test_extra_custom_serializer - dataclasses do not serialize extras
XFAIL tests/validators/test_union.py::test_smart_union_json_string_types_str_first[schema0-12345678-1234-5678-1234-567812345678] - TODO: V3
======================================================================= 4360 passed, 60 skipped, 2 xfailed in 16.50s ======================================================================== |
Yep as above I believe that's caused by your choice to pass |
Feel free to close if nothing more is on outstanding list. |
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesinstaller
modulecut off from access to the public network
(pytest is executed with-m "not network"
)Python 3.10.14 and pytest 8.2.1.
Here is pytest output:
List of installed modules in build env:
Please let me know if you need more details or want me to perform some diagnostics.
The text was updated successfully, but these errors were encountered: