-
-
Notifications
You must be signed in to change notification settings - Fork 2
Fix the CI #581
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
Merged
Fix the CI #581
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d5ab681
Fix the CI
joostlek 923b5f7
Fix the CI
joostlek 37f8c51
Fix the CI
joostlek 427af3a
Fix the CI
joostlek 5345ea2
Merge branch 'main' into fix-ci
joostlek 3c43f13
Fix the CI
joostlek 4390524
Fix the CI
joostlek 885e9bc
Fix the CI
joostlek b6224e5
Fix the CI
joostlek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ jobs: | |
| - name: 🏗 Install dependencies | ||
| run: poetry install --no-interaction | ||
| - name: 🚀 Run pytest | ||
| run: poetry run pytest --cov vehicle tests | ||
| run: poetry run pytest --cov youtubeaio tests | ||
| - name: ⬆️ Upload coverage artifact | ||
| uses: actions/[email protected] | ||
| with: | ||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,65 @@ | ||
| # serializer version: 1 | ||
| # name: test_fetch_video | ||
| 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'>)) | ||
| dict({ | ||
| 'nullable_content_details': dict({ | ||
| 'definition': <VideoDefinition.HD: 'hd'>, | ||
| 'dimension': <VideoDimension.D2: '2d'>, | ||
| 'licensed_content': True, | ||
| 'projection': <VideoProjection.RECTANGULAR: 'rectangular'>, | ||
| 'raw_caption': 'true', | ||
| 'raw_duration': 'PT21M3S', | ||
| }), | ||
| 'nullable_snippet': dict({ | ||
| 'channel_id': 'UCAuUUnT6oDeKwE6v1NGQxug', | ||
| 'channel_title': 'TED', | ||
| 'default_audio_language': 'en', | ||
| 'default_language': 'en', | ||
| '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/)Get TED Talks recommended just for you! Learn more at https://www.ted.com/signup.The 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.Follow TED on Twitter: http://www.twitter.com/TEDTalksLike TED on Facebook: https://www.facebook.com/TEDSubscribe to our channel: https://www.youtube.com/TED', | ||
| 'live_broadcast_content': <LiveBroadcastContent.NONE: 'none'>, | ||
| 'published_at': datetime.datetime(2012, 10, 1, 15, 27, 35, tzinfo=TzInfo(0)), | ||
| 'tags': list([ | ||
| 'Amy Cuddy', | ||
| 'TED', | ||
| 'TEDTalk', | ||
| 'TEDTalks', | ||
| 'TED Talk', | ||
| 'TED Talks', | ||
| 'TEDGlobal', | ||
| 'brain', | ||
| 'business', | ||
| 'psychology', | ||
| 'self', | ||
| 'success', | ||
| ]), | ||
| 'thumbnails': dict({ | ||
| 'default': dict({ | ||
| 'height': 90, | ||
| 'url': 'https://i.ytimg.com/vi/Ks-_Mh1QhMc/default.jpg', | ||
| 'width': 120, | ||
| }), | ||
| 'high': dict({ | ||
| 'height': 360, | ||
| 'url': 'https://i.ytimg.com/vi/Ks-_Mh1QhMc/hqdefault.jpg', | ||
| 'width': 480, | ||
| }), | ||
| 'maxres': dict({ | ||
| 'height': 720, | ||
| 'url': 'https://i.ytimg.com/vi/Ks-_Mh1QhMc/maxresdefault.jpg', | ||
| 'width': 1280, | ||
| }), | ||
| 'medium': dict({ | ||
| 'height': 180, | ||
| 'url': 'https://i.ytimg.com/vi/Ks-_Mh1QhMc/mqdefault.jpg', | ||
| 'width': 320, | ||
| }), | ||
| 'standard': dict({ | ||
| 'height': 480, | ||
| 'url': 'https://i.ytimg.com/vi/Ks-_Mh1QhMc/sddefault.jpg', | ||
| 'width': 640, | ||
| }), | ||
| }), | ||
| 'title': 'Your body language may shape who you are | Amy Cuddy', | ||
| }), | ||
| 'video_id': 'Ks-_Mh1QhMc', | ||
| }) | ||
| # --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| """Pytest configuration for Syrupy snapshot testing with Youtube extension.""" | ||
|
|
||
| import pytest | ||
|
|
||
| from syrupy import SnapshotAssertion | ||
| from tests.syrupy import YoutubeSnapshotExtension | ||
|
|
||
|
|
||
| @pytest.fixture(name="snapshot") | ||
| def snapshot_assertion(snapshot: SnapshotAssertion) -> SnapshotAssertion: | ||
| """Return snapshot assertion fixture with the Youtube extension.""" | ||
| return snapshot.use_extension(YoutubeSnapshotExtension) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Tests for the YouTube client.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Any | ||
|
|
||
| from pydantic import BaseModel | ||
| from syrupy.extensions import AmberSnapshotExtension | ||
| from syrupy.extensions.amber import AmberDataSerializer | ||
|
|
||
| if TYPE_CHECKING: | ||
| from syrupy.types import ( | ||
| PropertyFilter, | ||
| PropertyMatcher, | ||
| PropertyPath, | ||
| SerializableData, | ||
| ) | ||
|
|
||
|
|
||
| class YoutubeSnapshotSerializer(AmberDataSerializer): | ||
| """Youtube snapshot serializer for Syrupy. | ||
|
|
||
| Handles special cases for Youtube data structures. | ||
| """ | ||
|
|
||
| @classmethod | ||
| def _serialize( # pylint: disable=too-many-arguments | ||
| cls, | ||
| data: SerializableData, | ||
| *, | ||
| depth: int = 0, | ||
| exclude: PropertyFilter | None = None, | ||
| include: PropertyFilter | None = None, | ||
| matcher: PropertyMatcher | None = None, | ||
| path: PropertyPath = (), | ||
| visited: set[Any] | None = None, | ||
| ) -> str: | ||
| """Pre-process data before serializing. | ||
|
|
||
| This allows us to handle specific cases for | ||
| Youtube data structures. | ||
| """ | ||
| serializable_data = data | ||
| if isinstance(data, BaseModel): | ||
| serializable_data = data.model_dump() | ||
|
|
||
| return super()._serialize( | ||
| serializable_data, | ||
| depth=depth, | ||
| exclude=exclude, | ||
| include=include, | ||
| matcher=matcher, | ||
| path=path, | ||
| visited=visited, | ||
| ) | ||
|
|
||
|
|
||
| class YoutubeSnapshotExtension(AmberSnapshotExtension): | ||
| """Youtube extension for Syrupy.""" | ||
|
|
||
| VERSION = "1" | ||
| """Current version of serialization format. | ||
|
|
||
| Need to be bumped when we change the YoutubeSnapshotSerializer. | ||
| """ | ||
|
|
||
| serializer_class: type[AmberDataSerializer] = YoutubeSnapshotSerializer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be something off with the CI configuration. This should probably be