[DEV] Disable real runs in CI

This commit is contained in:
Jesse Bannon 2024-09-27 09:39:09 -07:00
parent 88fa55c9dc
commit a371c9cb12
11 changed files with 35 additions and 22 deletions

View file

@ -1,6 +1,7 @@
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.subscriptions.subscription import Subscription
@ -47,7 +48,7 @@ def youtube_release_preset_dict(output_directory):
class TestAudioExtract: class TestAudioExtract:
@pytest.mark.parametrize("dry_run", [False]) @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE)
def test_audio_extract_single_song( def test_audio_extract_single_song(
self, self,
default_config, default_config,
@ -73,7 +74,7 @@ class TestAudioExtract:
expected_download_summary_file_name="plugins/test_audio_extract_single.json", 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( def test_audio_extract_single_song_best_format(
self, self,
default_config, 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", 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( def test_audio_extract_multiple_songs(
self, self,
default_config, default_config,

View file

@ -3,6 +3,7 @@ from typing import Dict
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.subscriptions.subscription import Subscription
@ -54,7 +55,7 @@ def chapters_from_comments_preset_dict(sponsorblock_and_subs_preset_dict: Dict)
class TestChapters: 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( def test_chapters_sponsorblock_and_removal_with_subs(
self, self,
default_config, 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( def test_chapters_from_comments(
self, self,
default_config, default_config,

View file

@ -5,6 +5,7 @@ import pytest
from conftest import assert_logs from conftest import assert_logs
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.downloaders.ytdlp import YTDLP
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
@ -39,7 +40,7 @@ def rolling_recent_channel_preset_dict(recent_preset_dict):
class TestDateRange: 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]) @pytest.mark.parametrize("date_range_breaks", [True, False])
def test_recent_channel_download( def test_recent_channel_download(
self, self,
@ -93,7 +94,7 @@ class TestDateRange:
expected_download_summary_file_name="plugins/date_range/test_channel_recent.json", 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( def test_recent_channel_download__no_vids_in_range(
self, self,
tv_show_config, tv_show_config,
@ -125,7 +126,7 @@ class TestDateRange:
expected_download_summary_file_name="plugins/date_range/no_downloads.json", 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( def test_rolling_recent_channel_download(
self, self,
tv_show_config, tv_show_config,

View file

@ -2,6 +2,7 @@ import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches from expected_transaction_log import assert_transaction_log_matches
from mergedeep import mergedeep from mergedeep import mergedeep
from resources import E2E_DRY_RUN_FIXTURE_VALUE
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
@ -21,7 +22,7 @@ def preset_dict(output_directory):
class TestFileConvert: class TestFileConvert:
@pytest.mark.parametrize("dry_run", [True, False]) @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE)
def test_file_convert( def test_file_convert(
self, self,
default_config, default_config,
@ -47,7 +48,7 @@ class TestFileConvert:
expected_download_summary_file_name="plugins/file_convert/output.json", 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( def test_file_convert_custom_ffmpeg(
self, self,
default_config, default_config,

View file

@ -1,6 +1,7 @@
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.subscriptions.subscription import Subscription
@ -61,7 +62,7 @@ class TestFileConvert:
transaction_log = subscription.download(dry_run=False) transaction_log = subscription.download(dry_run=False)
assert transaction_log.is_empty 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( def test_match_filters_empty(
self, self,
default_config, default_config,
@ -78,7 +79,7 @@ class TestFileConvert:
transaction_log = subscription.download(dry_run=dry_run) transaction_log = subscription.download(dry_run=dry_run)
assert transaction_log.is_empty 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( def test_match_filters_partial(
self, self,
default_config, default_config,

View file

@ -4,6 +4,7 @@ import mergedeep
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.subscriptions.subscription import Subscription
from ytdl_sub.utils.exceptions import ValidationException 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: class TestSplitByChapters:
@pytest.mark.parametrize("dry_run", [True, False]) @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE)
def test_video_with_chapters( def test_video_with_chapters(
self, self,
default_config, default_config,
@ -96,7 +97,7 @@ class TestSplitByChapters:
transaction_log = subscription.download() transaction_log = subscription.download()
assert transaction_log.is_empty 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( def test_video_with_chapters_and_regex(
self, self,
default_config, default_config,
@ -122,7 +123,7 @@ class TestSplitByChapters:
expected_download_summary_file_name="plugins/split_by_chapters_with_regex_video.json", 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"]) @pytest.mark.parametrize("when_no_chapters", ["pass", "drop", "error"])
def test_video_with_no_chapters_and_regex( def test_video_with_no_chapters_and_regex(
self, self,

View file

@ -1,6 +1,7 @@
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.config.config_file import ConfigFile
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
@ -48,7 +49,7 @@ class TestSubtitles:
_ = ConfigFile.from_dict(default_config_dict) _ = 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( def test_subtitles_embedded(
self, self,
default_config, default_config,
@ -74,7 +75,7 @@ class TestSubtitles:
expected_download_summary_file_name="plugins/test_subtitles_embedded.json", 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( def test_subtitles_embedded_and_file(
self, self,
default_config, default_config,

View file

@ -4,6 +4,7 @@ from typing import Dict
import pytest import pytest
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.config.config_file import ConfigFile
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
@ -48,7 +49,7 @@ class TestChannel:
expected md5 file hashes. 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( def test_full_channel_download(
self, self,
tv_show_config, tv_show_config,

View file

@ -7,6 +7,7 @@ from e2e.conftest import mock_run_from_cli
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches from expected_transaction_log import assert_transaction_log_matches
from mergedeep import mergedeep from mergedeep import mergedeep
from resources import E2E_DRY_RUN_FIXTURE_VALUE
from ytdl_sub.config.config_file import ConfigFile from ytdl_sub.config.config_file import ConfigFile
from ytdl_sub.downloaders.ytdlp import YTDLP from ytdl_sub.downloaders.ytdlp import YTDLP
@ -144,7 +145,7 @@ class TestPlaylist:
expected_download_summary_file_name="youtube/test_playlist_archive_migrated.json", 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( def test_playlist_download(
self, self,
default_config, default_config,
@ -193,7 +194,7 @@ class TestPlaylist:
output_directory=output_directory, 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( def test_playlist_download_from_cli_sub_no_provided_config(
self, self,
preset_dict_to_subscription_yaml_generator, preset_dict_to_subscription_yaml_generator,

View file

@ -5,6 +5,7 @@ from conftest import preset_dict_to_dl_args
from e2e.conftest import mock_run_from_cli from e2e.conftest import mock_run_from_cli
from expected_download import assert_expected_downloads from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches 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.downloaders.ytdlp import YTDLP
from ytdl_sub.entries.entry import Entry from ytdl_sub.entries.entry import Entry
@ -78,7 +79,7 @@ def single_video_preset_dict_dl_args(single_video_preset_dict):
class TestYoutubeVideo: class TestYoutubeVideo:
@pytest.mark.parametrize("dry_run", [True, False]) @pytest.mark.parametrize("dry_run", E2E_DRY_RUN_FIXTURE_VALUE)
def test_single_video_download( def test_single_video_download(
self, self,
default_config, default_config,
@ -144,7 +145,7 @@ class TestYoutubeVideo:
expected_download_summary_file_name="youtube/test_video_missing_thumb.json", 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( def test_single_video_download_from_cli_dl(
self, self,
default_config_path, default_config_path,

View file

@ -3,10 +3,13 @@ import shutil
from pathlib import Path from pathlib import Path
REGENERATE_FIXTURES: bool = False REGENERATE_FIXTURES: bool = False
RUN_E2E_DOWNLOAD_TESTS: bool = False
RESOURCE_PATH: Path = Path("tests") / "resources" RESOURCE_PATH: Path = Path("tests") / "resources"
_FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures" _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: def file_fixture_path(fixture_name: str) -> Path:
return _FILE_FIXTURE_PATH / fixture_name return _FILE_FIXTURE_PATH / fixture_name