[DEV] Disable YouTube tests in GH CLI (#1090)

This commit is contained in:
Jesse Bannon 2024-10-07 23:46:27 -07:00 committed by GitHub
parent 8547ab569c
commit 0006c0ea94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 24 additions and 338 deletions

View file

@ -2,10 +2,12 @@ from typing import Optional
import pytest
from conftest import mock_run_from_cli
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.utils.file_handler import FileMetadata
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestView:
@pytest.mark.parametrize("split_chapters", [True, False])
def test_view_from_cli(

View file

@ -1,6 +1,7 @@
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
@ -46,6 +47,7 @@ def youtube_release_preset_dict(output_directory):
}
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [False])
def test_audio_extract_single_song(

View file

@ -3,6 +3,7 @@ from typing import Dict
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
@ -53,6 +54,7 @@ def chapters_from_comments_preset_dict(sponsorblock_and_subs_preset_dict: Dict)
return sponsorblock_and_subs_preset_dict
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestChapters:
@pytest.mark.parametrize("dry_run", [True, False])
def test_chapters_sponsorblock_and_removal_with_subs(

View file

@ -5,6 +5,7 @@ import pytest
from conftest import assert_logs
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.downloaders.ytdlp import YTDLP
from ytdl_sub.subscriptions.subscription import Subscription
@ -38,6 +39,7 @@ def rolling_recent_channel_preset_dict(recent_preset_dict):
)
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestDateRange:
@pytest.mark.parametrize("dry_run", [True, False])
@pytest.mark.parametrize("date_range_breaks", [True, False])

View file

@ -1,6 +1,7 @@
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
@ -19,6 +20,7 @@ def preset_dict(output_directory):
}
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestFileConvert:
@pytest.mark.parametrize("dry_run", [True, False])
def test_file_convert(

View file

@ -1,6 +1,7 @@
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
@ -45,6 +46,7 @@ def livestream_preset_dict(output_directory):
}
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestFileConvert:
def test_livestreams_download_filtered(
self,

View file

@ -4,6 +4,7 @@ import mergedeep
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
from ytdl_sub.utils.exceptions import ValidationException
@ -57,6 +58,7 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict
return yt_album_as_chapters_preset_dict
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestSplitByChapters:
@pytest.mark.parametrize("dry_run", [True, False])
def test_video_with_chapters(

View file

@ -1,6 +1,7 @@
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.config.config_file import ConfigFile
from ytdl_sub.subscriptions.subscription import Subscription
@ -31,6 +32,7 @@ def test_single_video_subs_embed_and_file_preset_dict(single_video_subs_embed_pr
return single_video_subs_embed_preset_dict
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestSubtitles:
def test_subtitle_lang_variable_partial_validates(self, default_config):
default_config_dict = default_config.as_dict()

View file

@ -1,52 +1,13 @@
from typing import Dict
import pytest
from conftest import assert_logs
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.config.config_file import ConfigFile
from ytdl_sub.downloaders.ytdlp import YTDLP
from ytdl_sub.subscriptions.subscription import Subscription
@pytest.fixture
def playlist_preset_dict(output_directory):
return {
"preset": [
"jellyfin_tv_show_collection",
"season_by_collection__episode_by_year_month_day",
"collection_season_1",
],
"format": "worst[ext=mp4]", # download the worst format so it is fast
"output_directory_nfo_tags": {
"nfo_name": "tvshow.nfo",
"nfo_root": "test",
"tags": {
"playlist_title": "{playlist_title}",
"playlist_uploader": "{playlist_uploader}",
"playlist_description": "{playlist_description}",
},
},
"nfo_tags": {
"tags": {
"playlist_index": "{playlist_index}",
"playlist_count": "{playlist_count}",
}
},
"subtitles": {
"subtitles_name": "{episode_file_path}.{lang}.{subtitles_ext}",
"allow_auto_generated_subtitles": True,
},
"overrides": {
"tv_show_name": "JMC",
"tv_show_directory": output_directory,
"collection_season_1_url": "https://youtube.com/playlist?list=PL5BC0FC26BECA5A35",
"collection_season_1_name": "JMC - Season 1",
},
}
@pytest.fixture
def tv_show_by_date_bilateral_dict(output_directory):
return {
@ -90,53 +51,8 @@ def tv_show_collection_bilateral_dict(output_directory):
}
class TestPlaylist:
"""
Downloads my old minecraft youtube channel, pretends they are music videos. Ensure the above
files exist and have the expected md5 file hashes.
"""
@pytest.mark.parametrize("dry_run", [True, False])
def test_playlist_download(
self,
default_config,
playlist_preset_dict,
output_directory,
dry_run,
):
playlist_subscription = Subscription.from_dict(
config=default_config,
preset_name="music_video_playlist_test",
preset_dict=playlist_preset_dict,
)
transaction_log = playlist_subscription.download(dry_run=dry_run)
assert_transaction_log_matches(
output_directory=output_directory,
transaction_log=transaction_log,
transaction_log_summary_file_name="youtube/test_playlist.txt",
)
assert_expected_downloads(
output_directory=output_directory,
dry_run=dry_run,
expected_download_summary_file_name="youtube/test_playlist.json",
)
# Ensure another invocation will hit ExistingVideoReached
if not dry_run:
with assert_logs(
logger=YTDLP.logger,
expected_message="ExistingVideoReached, stopping additional downloads",
log_level="debug",
):
transaction_log = playlist_subscription.download()
assert transaction_log.is_empty
assert_expected_downloads(
output_directory=output_directory,
dry_run=dry_run,
expected_download_summary_file_name="youtube/test_playlist.json",
)
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestBilateral:
def test_tv_show_by_date_downloads_bilateral(
self,

View file

@ -4,6 +4,7 @@ from typing import Dict
import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.config.config_file import ConfigFile
from ytdl_sub.subscriptions.subscription import Subscription
@ -42,6 +43,7 @@ def channel_preset_dict(output_directory):
}
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestChannel:
"""
Downloads my old minecraft youtube channel. Ensure the above files exist and have the

View file

@ -1,7 +1,7 @@
import pytest
from conftest import preset_dict_to_dl_args
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from resources import DISABLE_YOUTUBE_TESTS
from ytdl_sub.subscriptions.subscription import Subscription
@ -30,11 +30,7 @@ def single_video_preset_dict(output_directory):
}
@pytest.fixture
def single_video_preset_dict_dl_args(single_video_preset_dict):
return preset_dict_to_dl_args(single_video_preset_dict)
@pytest.mark.skipif(DISABLE_YOUTUBE_TESTS, reason="YouTube tests cannot run in GH")
class TestYoutubeVideo:
@pytest.mark.parametrize("dry_run", [True, False])
def test_single_video_download(

View file

@ -2,6 +2,7 @@ import os
import shutil
from pathlib import Path
DISABLE_YOUTUBE_TESTS: bool = True
REGENERATE_FIXTURES: bool = False
RESOURCE_PATH: Path = Path("tests") / "resources"

View file

@ -1,19 +0,0 @@
{
"JMC/.ytdl-sub-music_video_playlist_test-download-archive.json": "3fdab8d103e51aa70430b6da0ceb07e2",
"JMC/Season 01/s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1]-thumb.jpg": "b232d253df621aa770b780c1301d364d",
"JMC/Season 01/s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].info.json": "INFO_JSON",
"JMC/Season 01/s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].mp4": "7fa67dd3a895da12c17669b0fa2f3763",
"JMC/Season 01/s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].nfo": "2a2997cbf16fb6b943d9933ad267331e",
"JMC/Season 01/s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27]-thumb.jpg": "d17c379ea8b362f5b97c6b213b0342cb",
"JMC/Season 01/s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].info.json": "INFO_JSON",
"JMC/Season 01/s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].mp4": "5a3ffa5cee2f58f5001502ab3823d130",
"JMC/Season 01/s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].nfo": "da7645e8826586388ae0d8278ef6a1c1",
"JMC/Season 01/s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21]-thumb.jpg": "e7830aa8a64b0cde65ba3f7e5fc56530",
"JMC/Season 01/s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].info.json": "INFO_JSON",
"JMC/Season 01/s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].mp4": "91f22944f797513fcda9856e244dd3b3",
"JMC/Season 01/s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].nfo": "c56083e2f3545fa2cafc4d67cbfdacf8",
"JMC/fanart.jpg": "129c6639b47299bc48062f0365e670ee",
"JMC/poster.jpg": "5de28eea5a921a041452ab3ce1041f73",
"JMC/season01-poster.jpg": "e7830aa8a64b0cde65ba3f7e5fc56530",
"JMC/tvshow.nfo": "e92e4a2c01522dd9a9c3423f0f9304dc"
}

View file

@ -1,226 +0,0 @@
Files created:
----------------------------------------
{output_directory}
.ytdl-sub-music_video_playlist_test-download-archive.json
fanart.jpg
poster.jpg
season01-poster.jpg
tvshow.nfo
NFO tags:
test:
genre: ytdl-sub
mpaa: TV-14
namedseason:
attributes:
number: 1
tag: JMC - Season 1
playlist_description: Trailers, Updates, etc
playlist_title: Jesse's Minecraft Server
playlist_uploader: Project Zombie
title: JMC
{output_directory}/Season 01
s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1]-thumb.jpg
s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].info.json
s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].mp4
Video Tags:
contentRating: TV-14
date: 2011-02-01
episode_id: 11020101
genre: ytdl-sub
show: JMC
synopsis:
https://www.youtube.com/watch?v=0SVukUyys10
To join the server, you must apply at:
http://www.jesseminecraft.webs.com/
This is just a brief video of the server as of Feb. 1, 2011.
Texture Pack I Use:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
title: 2011-02-01 - Jesse's Minecraft Server [Trailer - Feb.1]
year: 2011
s01.e11020101 - Jesse's Minecraft Server [Trailer - Feb.1].nfo
NFO tags:
episodedetails:
aired: 2011-02-01
episode: 11020101
genre: ytdl-sub
mpaa: TV-14
playlist_count: 3
playlist_index: 3
plot:
https://www.youtube.com/watch?v=0SVukUyys10
To join the server, you must apply at:
http://www.jesseminecraft.webs.com/
This is just a brief video of the server as of Feb. 1, 2011.
Texture Pack I Use:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
season: 1
title: 2011-02-01 - Jesse's Minecraft Server [Trailer - Feb.1]
year: 2011
s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27]-thumb.jpg
s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].info.json
s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].mp4
Video Tags:
contentRating: TV-14
date: 2011-02-27
episode_id: 11022701
genre: ytdl-sub
show: JMC
synopsis:
https://www.youtube.com/watch?v=qPybBrXspds
Website Link:
http://jesseminecraft.webs.com/
All you have to do is read the rules, and fill out a quick, little application to join the Server so we know you read them. We do this to keep the griefers/newbs out, it only takes three minutes, it's not that big of a deal.
Jesse's Minecraft Server is a City Roleplay/Survival Server, there is a currency, public transportation, strict rules for immersive gameplay, and has a decent size population. Over 750 people have logged onto the server. It is very important you read the rules, we don't tolerate idiots.
There are over 200 empty properties that are ready for anyone to own! Join now!
This is the server state as of Feb. 27, 2011.
----------------------------------------------------------------------------------
Texture Pack:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
Recording Software:
http://www.fraps.com/download.php
Video Editing Software:
http://explore.live.com/windows-live-movie-maker?os=other
Song:
Given to Fly - Pearl Jam
(Off of the 'Yield' album)
I claim no ownership of this song, all the credit goes to Pearl Jam and their producers.
title: 2011-02-27 - Jesse's Minecraft Server [Trailer - Feb.27]
year: 2011
s01.e11022701 - Jesse's Minecraft Server [Trailer - Feb.27].nfo
NFO tags:
episodedetails:
aired: 2011-02-27
episode: 11022701
genre: ytdl-sub
mpaa: TV-14
playlist_count: 3
playlist_index: 2
plot:
https://www.youtube.com/watch?v=qPybBrXspds
Website Link:
http://jesseminecraft.webs.com/
All you have to do is read the rules, and fill out a quick, little application to join the Server so we know you read them. We do this to keep the griefers/newbs out, it only takes three minutes, it's not that big of a deal.
Jesse's Minecraft Server is a City Roleplay/Survival Server, there is a currency, public transportation, strict rules for immersive gameplay, and has a decent size population. Over 750 people have logged onto the server. It is very important you read the rules, we don't tolerate idiots.
There are over 200 empty properties that are ready for anyone to own! Join now!
This is the server state as of Feb. 27, 2011.
----------------------------------------------------------------------------------
Texture Pack:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
Recording Software:
http://www.fraps.com/download.php
Video Editing Software:
http://explore.live.com/windows-live-movie-maker?os=other
Song:
Given to Fly - Pearl Jam
(Off of the 'Yield' album)
I claim no ownership of this song, all the credit goes to Pearl Jam and their producers.
season: 1
title: 2011-02-27 - Jesse's Minecraft Server [Trailer - Feb.27]
year: 2011
s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21]-thumb.jpg
s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].info.json
s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].mp4
Video Tags:
contentRating: TV-14
date: 2011-03-21
episode_id: 11032101
genre: ytdl-sub
show: JMC
synopsis:
https://www.youtube.com/watch?v=DBjFvs6HafU
Website Link:
http://jesseminecraft.webs.com/
To get on the whitelist, please look at the website linked above (^^^). Due to the overwhelming amount of people trying to join, I've made it so it costs $2 to become a member through paypal. All of it is explained on the website.
Jesse's Minecraft Server is a City Roleplay/Survival Server, there is a currency, public transportation, strict rules for immersive gameplay, and has a decent size population. Over 1000 people have logged onto the server. It is very important you read the rules, we don't tolerate idiots.
There are over 300 empty properties that are ready for anyone to own! Join now!
This is the server state as of Mar. 21, 2011.
--------------------------------------------------------------------------------­--
Texture Pack:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
Recording Software:
http://www.fraps.com/download.php
Video Editing Software:
http://explore.live.com/windows-live-movie-maker?os=other
Song:
Indifference - Pearl Jam
(Off of the 'Vs.' album)
I claim no ownership of this song, all the credit goes to Pearl Jam and their producers.
title: 2011-03-21 - Jesse's Minecraft Server [Trailer - Mar.21]
year: 2011
s01.e11032101 - Jesse's Minecraft Server [Trailer - Mar.21].nfo
NFO tags:
episodedetails:
aired: 2011-03-21
episode: 11032101
genre: ytdl-sub
mpaa: TV-14
playlist_count: 3
playlist_index: 1
plot:
https://www.youtube.com/watch?v=DBjFvs6HafU
Website Link:
http://jesseminecraft.webs.com/
To get on the whitelist, please look at the website linked above (^^^). Due to the overwhelming amount of people trying to join, I've made it so it costs $2 to become a member through paypal. All of it is explained on the website.
Jesse's Minecraft Server is a City Roleplay/Survival Server, there is a currency, public transportation, strict rules for immersive gameplay, and has a decent size population. Over 1000 people have logged onto the server. It is very important you read the rules, we don't tolerate idiots.
There are over 300 empty properties that are ready for anyone to own! Join now!
This is the server state as of Mar. 21, 2011.
--------------------------------------------------------------------------------­--
Texture Pack:
http://www.minecraftforum.net/viewtopic.php?f=25&t=29164
Recording Software:
http://www.fraps.com/download.php
Video Editing Software:
http://explore.live.com/windows-live-movie-maker?os=other
Song:
Indifference - Pearl Jam
(Off of the 'Vs.' album)
I claim no ownership of this song, all the credit goes to Pearl Jam and their producers.
season: 1
title: 2011-03-21 - Jesse's Minecraft Server [Trailer - Mar.21]
year: 2011