Source: python-youtubeaio
Version: 2.0.0-1
Severity: serious
Tags: ftbfs

python-youtubeaio fails to build with pydantic-core 2.37.2-1 / pydantic 
2.12.0~a1-1 in unstable.

I: pybuild base:311: cd 
/build/reproducible-path/python-youtubeaio-2.0.0/.pybuild/cpython3_3.13/build; 
python3.13 -m pytest --no-cov
============================= test session starts ==============================
platform linux -- Python 3.13.7, pytest-8.4.1, pluggy-1.6.0
rootdir: 
/build/reproducible-path/python-youtubeaio-2.0.0/.pybuild/cpython3_3.13/build
configfile: pyproject.toml
plugins: aresponses-3.0.0, asyncio-0.25.1, syrupy-4.9.1, cov-5.0.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None
collected 56 items

tests/test_auth.py ...                                                   [  5%]
tests/test_channel.py .......                                            [ 17%]
tests/test_helper.py ................                                    [ 46%]
tests/test_oauth.py ....                                                 [ 53%]
tests/test_playlist_item.py ...                                          [ 58%]
tests/test_subscription.py ...                                           [ 64%]
tests/test_video.py F..........                                          [ 83%]
tests/test_youtube.py .........                                          [100%]

  =================================== FAILURES 
===================================
  _______________________________ test_fetch_video 
_______________________________

  aresponses = <aresponses.main.ResponsesMockServer object at 0x7f2ef67ea210>
  snapshot = YouTubeVideo(video_id='Ks-_Mh1QhMc', 
nullable_snippet=YouTubeVideoSnippet(published_at=datetime.datetime(2012, 10, 
1, ...inition.HD: 'hd'>, raw_caption='true', licensed_content=True, 
projection=<VideoProjection.RECTANGULAR: 'rectangular'>))

      async def test_fetch_video(
          aresponses: ResponsesMockServer,
          snapshot: SnapshotAssertion,
      ) -> None:
          """Test retrieving a video."""
          aresponses.add(
              YOUTUBE_URL,
              "/youtube/v3/videos",
              "GET",
              aresponses.Response(
                  status=200,
                  headers={"Content-Type": "application/json"},
                  text=json.dumps(
                      construct_fixture("video", ["snippet", "contentDetails"], 
1),
                  ),
              ),
          )
          async with aiohttp.ClientSession() as session, 
YouTube(session=session) as youtube:
              video = await youtube.get_video(video_id="Ks-_Mh1QhMc")
  >           assert video == snapshot
  E           assert [+ received] == [- snapshot]
  E             - YouTubeVideo(video_id='Ks-_Mh1QhMc', 
nullable_snippet=YouTubeVideoSnippet(published_at=datetime.datetime(2012, 10, 
1, 15, 27, 35, tzinfo=TzInfo(UTC)), channel_id='UCAuUUnT6oDeKwE6v1NGQxug', 
title='Your body language may shape who you are | Amy Cuddy', description='Body 
language affects how others see us, but it may also change how we see 
ourselves. Social psychologist Amy Cuddy argues that "power posing" -- standing 
in a posture of confidence, even when we don\'t feel confident -- can boost 
feelings of confidence, and might have an impact on our chances for success. 
(Note: Some of the findings presented...
  E
  E             ...Full output truncated (2 lines hidden), use '-vv' to show

  tests/test_video.py:41: AssertionError
  =============================== warnings summary 
===============================
  tests/test_helper.py::test_first
  tests/test_helper.py::test_limit
    /usr/lib/python3.13/asyncio/base_events.py:750: RuntimeWarning: coroutine 
method 'aclose' of '_generator' was never awaited
      self._ready.clear()
    Enable tracemalloc to get traceback where the object was allocated.
    See 
https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings
 for more info.

  -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
  --------------------------- snapshot report summary 
----------------------------
  1 snapshot failed.
  =========================== short test summary info 
============================
  FAILED tests/test_video.py::test_fetch_video - assert [+ received] == [- 
snap...
  =================== 1 failed, 55 passed, 2 warnings in 1.18s 
===================
  E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd 
/build/reproducible-path/python-youtubeaio-2.0.0/.pybuild/cpython3_3.13/build; 
python3.13 -m pytest --no-cov
  dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.13 
returned exit code 13

With --pdb:

  -> assert video == snapshot
  (Pdb) p video
  YouTubeVideo(video_id='Ks-_Mh1QhMc', 
nullable_snippet=YouTubeVideoSnippet(published_at=datetime.datetime(2012, 10, 
1, 15, 27, 35, tzinfo=TzInfo(0)), channel_id='UCAuUUnT6oDeKwE6v1NGQxug', 
title='Your body language may shape who you are | Amy Cuddy', description='Body 
language affects how others see us, but it may also change how we see 
ourselves. Social psychologist Amy Cuddy argues that "power posing" -- standing 
in a posture of confidence, even when we don\'t feel confident -- can boost 
feelings of confidence, and might have an impact on our chances for success. 
(Note: Some of the findings presented in this talk have been referenced in an 
ongoing debate among social scientists about robustness and reproducibility. 
Read Amy Cuddy\'s response here: 
http://ideas.ted.com/inside-the-debate-about-power-posing-a-q-a-with-amy-cuddy/)\n\nGet
 TED Talks recommended just for you! Learn more at 
https://www.ted.com/signup.\n\nThe TED Talks channel features the best talks 
and performances from the TED Conference, where the world\'s leading thinkers 
and doers give the talk of their lives in 18 minutes (or less). Look for talks 
on Technology, Entertainment and Design -- plus science, business, global 
issues, the arts and more.\n\nFollow TED on Twitter: 
http://www.twitter.com/TEDTalks\nLike TED on Facebook: 
https://www.facebook.com/TED\n\nSubscribe to our channel: 
https://www.youtube.com/TED', 
thumbnails=YouTubeVideoThumbnails(default=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/default.jpg',
 width=120, height=90), 
medium=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/mqdefault.jpg', 
width=320, height=180), 
high=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/hqdefault.jpg', 
width=480, height=360), 
standard=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/sddefault.jpg',
 width=640, height=480), 
maxres=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/maxresdefault.jpg',
 width=1280, height=720)), channel_title='TED', tags=['Amy Cuddy', 'TED', 
'TEDTalk', 'TEDTalks', 'TED Talk', 'TED Talks', 'TEDGlobal', 'brain', 
'business', 'psychology', 'self', 'success'], 
live_broadcast_content=<LiveBroadcastContent.NONE: 'none'>, 
default_language='en', default_audio_language='en'), 
nullable_content_details=YouTubeVideoContentDetails(raw_duration='PT21M3S', 
dimension=<VideoDimension.D2: '2d'>, definition=<VideoDefinition.HD: 'hd'>, 
raw_caption='true', licensed_content=True, 
projection=<VideoProjection.RECTANGULAR: 'rectangular'>))
  (Pdb) p snapshot
  YouTubeVideo(video_id='Ks-_Mh1QhMc', 
nullable_snippet=YouTubeVideoSnippet(published_at=datetime.datetime(2012, 10, 
1, 15, 27, 35, tzinfo=TzInfo(UTC)), channel_id='UCAuUUnT6oDeKwE6v1NGQxug', 
title='Your body language may shape who you are | Amy Cuddy', description='Body 
language affects how others see us, but it may also change how we see 
ourselves. Social psychologist Amy Cuddy argues that "power posing" -- standing 
in a posture of confidence, even when we don\'t feel confident -- can boost 
feelings of confidence, and might have an impact on our chances for success. 
(Note: Some of the findings presented in this talk have been referenced in an 
ongoing debate among social scientists about robustness and reproducibility. 
Read Amy Cuddy\'s response here: 
http://ideas.ted.com/inside-the-debate-about-power-posing-a-q-a-with-amy-cuddy/)\n\nGet
 TED Talks recommended just for you! Learn more at 
https://www.ted.com/signup.\n\nThe TED Talks channel features the best talks 
and performances from the TED Conference, where the world\'s leading thinkers 
and doers give the talk of their lives in 18 minutes (or less). Look for talks 
on Technology, Entertainment and Design -- plus science, business, global 
issues, the arts and more.\n\nFollow TED on Twitter: 
http://www.twitter.com/TEDTalks\nLike TED on Facebook: 
https://www.facebook.com/TED\n\nSubscribe to our channel: 
https://www.youtube.com/TED', 
thumbnails=YouTubeVideoThumbnails(default=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/default.jpg',
 width=120, height=90), 
medium=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/mqdefault.jpg', 
width=320, height=180), 
high=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/hqdefault.jpg', 
width=480, height=360), 
standard=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/sddefault.jpg',
 width=640, height=480), 
maxres=YouTubeThumbnail(url='https://i.ytimg.com/vi/Ks-_Mh1QhMc/maxresdefault.jpg',
 width=1280, height=720)), channel_title='TED', tags=['Amy Cuddy', 'TED', 
'TEDTalk', 'TEDTalks', 'TED Talk', 'TED Talks', 'TEDGlobal', 'brain', 
'business', 'psychology', 'self', 'success'], 
live_broadcast_content=<LiveBroadcastContent.NONE: 'none'>, 
default_language='en', default_audio_language='en'), 
nullable_content_details=YouTubeVideoContentDetails(raw_duration='PT21M3S', 
dimension=<VideoDimension.D2: '2d'>, definition=<VideoDefinition.HD: 'hd'>, 
raw_caption='true', licensed_content=True, 
projection=<VideoProjection.RECTANGULAR: 'rectangular'>))

So the problem is "tzinfo(UTC)" in tests/__snapshots__/test_video.ambr, 
and changing that to "tzinfo(0)" makes the test pass.  That was enough 
to let me track it down to the root cause: this was introduced by 
https://github.com/pydantic/pydantic-core/pull/1701 to fix 
https://github.com/pydantic/pydantic-core/issues/1691.

If possible, it would be best for a fix to work with both old and new 
versions of pydantic-core, since that will simplify the job of getting 
all this into testing.

Thanks,

-- 
Colin Watson (he/him)                              [[email protected]]

Reply via email to