[DEV] Disable YouTube tests in GH CLI
This commit is contained in:
parent
1499d7486c
commit
ee60b15549
15 changed files with 45 additions and 98 deletions
|
|
@ -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,7 +46,9 @@ 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(
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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(
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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])
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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(
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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,
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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(
|
||||
|
|
|
|||
|
|
@ -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,9 @@ 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()
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ class TestBandcamp:
|
|||
assert_transaction_log_matches(
|
||||
output_directory=output_directory,
|
||||
transaction_log=transaction_log,
|
||||
transaction_log_summary_file_name="bandcamp/test_artist_url.txt",
|
||||
transaction_log_summary_file_name="presets/test_artist_url.txt",
|
||||
)
|
||||
assert_expected_downloads(
|
||||
output_directory=output_directory,
|
||||
dry_run=dry_run,
|
||||
expected_download_summary_file_name="bandcamp/test_artist_url.json",
|
||||
expected_download_summary_file_name="presets/test_artist_url.json",
|
||||
)
|
||||
|
||||
# Ensure another invocation will hit ExistingVideoReached
|
||||
|
|
@ -67,5 +67,5 @@ class TestBandcamp:
|
|||
assert_expected_downloads(
|
||||
output_directory=output_directory,
|
||||
dry_run=dry_run,
|
||||
expected_download_summary_file_name="bandcamp/test_artist_url.json",
|
||||
expected_download_summary_file_name="presets/test_artist_url.json",
|
||||
)
|
||||
|
|
@ -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,10 @@ 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,
|
||||
|
|
@ -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,9 @@ 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -29,12 +29,9 @@ 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(
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue