From a371c9cb12e55a49e0fc26d0718d926f78803ff2 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Fri, 27 Sep 2024 09:39:09 -0700 Subject: [PATCH] [DEV] Disable real runs in CI --- tests/e2e/plugins/test_audio_extract.py | 7 ++++--- tests/e2e/plugins/test_chapters.py | 5 +++-- tests/e2e/plugins/test_date_range.py | 7 ++++--- tests/e2e/plugins/test_file_convert.py | 5 +++-- tests/e2e/plugins/test_match_filters.py | 5 +++-- tests/e2e/plugins/test_split_by_chapters.py | 7 ++++--- tests/e2e/plugins/test_subtitles.py | 5 +++-- tests/e2e/youtube/test_channel.py | 3 ++- tests/e2e/youtube/test_playlist.py | 5 +++-- tests/e2e/youtube/test_video.py | 5 +++-- tests/resources.py | 3 +++ 11 files changed, 35 insertions(+), 22 deletions(-) diff --git a/tests/e2e/plugins/test_audio_extract.py b/tests/e2e/plugins/test_audio_extract.py index 90be1603..0c6d6f17 100644 --- a/tests/e2e/plugins/test_audio_extract.py +++ b/tests/e2e/plugins/test_audio_extract.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.subscriptions.subscription import Subscription @@ -47,7 +48,7 @@ def youtube_release_preset_dict(output_directory): class TestAudioExtract: - @pytest.mark.parametrize("dry_run", [False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_audio_extract_single_song( self, default_config, @@ -73,7 +74,7 @@ class TestAudioExtract: expected_download_summary_file_name="plugins/test_audio_extract_single.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_audio_extract_single_song_best_format( self, default_config, @@ -99,7 +100,7 @@ class TestAudioExtract: expected_download_summary_file_name=f"plugins/test_audio_extract_single_best{'_dry_run' if dry_run else ''}.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_audio_extract_multiple_songs( self, default_config, diff --git a/tests/e2e/plugins/test_chapters.py b/tests/e2e/plugins/test_chapters.py index 3a5eed4d..f8fb9870 100644 --- a/tests/e2e/plugins/test_chapters.py +++ b/tests/e2e/plugins/test_chapters.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.subscriptions.subscription import Subscription @@ -54,7 +55,7 @@ def chapters_from_comments_preset_dict(sponsorblock_and_subs_preset_dict: Dict) class TestChapters: - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_chapters_sponsorblock_and_removal_with_subs( self, default_config, @@ -83,7 +84,7 @@ class TestChapters: ], ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_chapters_from_comments( self, default_config, diff --git a/tests/e2e/plugins/test_date_range.py b/tests/e2e/plugins/test_date_range.py index e803fa36..2d81c763 100644 --- a/tests/e2e/plugins/test_date_range.py +++ b/tests/e2e/plugins/test_date_range.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.downloaders.ytdlp import YTDLP from ytdl_sub.subscriptions.subscription import Subscription @@ -39,7 +40,7 @@ def rolling_recent_channel_preset_dict(recent_preset_dict): class TestDateRange: - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) @pytest.mark.parametrize("date_range_breaks", [True, False]) def test_recent_channel_download( self, @@ -93,7 +94,7 @@ class TestDateRange: expected_download_summary_file_name="plugins/date_range/test_channel_recent.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_recent_channel_download__no_vids_in_range( self, tv_show_config, @@ -125,7 +126,7 @@ class TestDateRange: expected_download_summary_file_name="plugins/date_range/no_downloads.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_rolling_recent_channel_download( self, tv_show_config, diff --git a/tests/e2e/plugins/test_file_convert.py b/tests/e2e/plugins/test_file_convert.py index e3832172..c41bc12a 100644 --- a/tests/e2e/plugins/test_file_convert.py +++ b/tests/e2e/plugins/test_file_convert.py @@ -2,6 +2,7 @@ import pytest from expected_download import assert_expected_downloads from expected_transaction_log import assert_transaction_log_matches from mergedeep import mergedeep +from resources import E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.subscriptions.subscription import Subscription @@ -21,7 +22,7 @@ def preset_dict(output_directory): class TestFileConvert: - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_file_convert( self, default_config, @@ -47,7 +48,7 @@ class TestFileConvert: expected_download_summary_file_name="plugins/file_convert/output.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_file_convert_custom_ffmpeg( self, default_config, diff --git a/tests/e2e/plugins/test_match_filters.py b/tests/e2e/plugins/test_match_filters.py index 2e669319..cbb0743d 100644 --- a/tests/e2e/plugins/test_match_filters.py +++ b/tests/e2e/plugins/test_match_filters.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.subscriptions.subscription import Subscription @@ -61,7 +62,7 @@ class TestFileConvert: transaction_log = subscription.download(dry_run=False) assert transaction_log.is_empty - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_match_filters_empty( self, default_config, @@ -78,7 +79,7 @@ class TestFileConvert: transaction_log = subscription.download(dry_run=dry_run) assert transaction_log.is_empty - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_match_filters_partial( self, default_config, diff --git a/tests/e2e/plugins/test_split_by_chapters.py b/tests/e2e/plugins/test_split_by_chapters.py index cb02715e..fe24ea43 100644 --- a/tests/e2e/plugins/test_split_by_chapters.py +++ b/tests/e2e/plugins/test_split_by_chapters.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.utils.exceptions import ValidationException @@ -66,7 +67,7 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict class TestSplitByChapters: - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_video_with_chapters( self, default_config, @@ -96,7 +97,7 @@ class TestSplitByChapters: transaction_log = subscription.download() assert transaction_log.is_empty - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_video_with_chapters_and_regex( self, default_config, @@ -122,7 +123,7 @@ class TestSplitByChapters: expected_download_summary_file_name="plugins/split_by_chapters_with_regex_video.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) @pytest.mark.parametrize("when_no_chapters", ["pass", "drop", "error"]) def test_video_with_no_chapters_and_regex( self, diff --git a/tests/e2e/plugins/test_subtitles.py b/tests/e2e/plugins/test_subtitles.py index ae5e14e9..f4a4503d 100644 --- a/tests/e2e/plugins/test_subtitles.py +++ b/tests/e2e/plugins/test_subtitles.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.config.config_file import ConfigFile from ytdl_sub.subscriptions.subscription import Subscription @@ -48,7 +49,7 @@ class TestSubtitles: _ = ConfigFile.from_dict(default_config_dict) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_subtitles_embedded( self, default_config, @@ -74,7 +75,7 @@ class TestSubtitles: expected_download_summary_file_name="plugins/test_subtitles_embedded.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_subtitles_embedded_and_file( self, default_config, diff --git a/tests/e2e/youtube/test_channel.py b/tests/e2e/youtube/test_channel.py index 4ed9fe20..de2007df 100644 --- a/tests/e2e/youtube/test_channel.py +++ b/tests/e2e/youtube/test_channel.py @@ -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 E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.config.config_file import ConfigFile from ytdl_sub.subscriptions.subscription import Subscription @@ -48,7 +49,7 @@ class TestChannel: expected md5 file hashes. """ - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_full_channel_download( self, tv_show_config, diff --git a/tests/e2e/youtube/test_playlist.py b/tests/e2e/youtube/test_playlist.py index e173c568..037d9ed2 100644 --- a/tests/e2e/youtube/test_playlist.py +++ b/tests/e2e/youtube/test_playlist.py @@ -7,6 +7,7 @@ from e2e.conftest import mock_run_from_cli from expected_download import assert_expected_downloads from expected_transaction_log import assert_transaction_log_matches from mergedeep import mergedeep +from resources import E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.config.config_file import ConfigFile from ytdl_sub.downloaders.ytdlp import YTDLP @@ -144,7 +145,7 @@ class TestPlaylist: expected_download_summary_file_name="youtube/test_playlist_archive_migrated.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_playlist_download( self, default_config, @@ -193,7 +194,7 @@ class TestPlaylist: output_directory=output_directory, ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_playlist_download_from_cli_sub_no_provided_config( self, preset_dict_to_subscription_yaml_generator, diff --git a/tests/e2e/youtube/test_video.py b/tests/e2e/youtube/test_video.py index 7435a60a..a838abc2 100644 --- a/tests/e2e/youtube/test_video.py +++ b/tests/e2e/youtube/test_video.py @@ -5,6 +5,7 @@ from conftest import preset_dict_to_dl_args from e2e.conftest import mock_run_from_cli from expected_download import assert_expected_downloads from expected_transaction_log import assert_transaction_log_matches +from resources import E2E_DRY_RUN_FIXTURE_VALUE from ytdl_sub.downloaders.ytdlp import YTDLP from ytdl_sub.entries.entry import Entry @@ -78,7 +79,7 @@ def single_video_preset_dict_dl_args(single_video_preset_dict): class TestYoutubeVideo: - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_single_video_download( self, default_config, @@ -144,7 +145,7 @@ class TestYoutubeVideo: expected_download_summary_file_name="youtube/test_video_missing_thumb.json", ) - @pytest.mark.parametrize("dry_run", [True, False]) + @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE) def test_single_video_download_from_cli_dl( self, default_config_path, diff --git a/tests/resources.py b/tests/resources.py index 8a426c9e..4c325c7c 100644 --- a/tests/resources.py +++ b/tests/resources.py @@ -3,10 +3,13 @@ import shutil from pathlib import Path REGENERATE_FIXTURES: bool = False +RUN_E2E_DOWNLOAD_TESTS: bool = False RESOURCE_PATH: Path = Path("tests") / "resources" _FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures" +E2E_DRY_RUN_FIXTURE_VALUE = [True, False] if RUN_E2E_DOWNLOAD_TESTS else [True] + def file_fixture_path(fixture_name: str) -> Path: return _FILE_FIXTURE_PATH / fixture_name