diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..d6644fd9 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,7 @@ +# Add test modules to the system path so pycharm auto-imports work +import os +import sys + +PROJECT_PATH = os.getcwd() +TESTS_PATH = os.path.join(PROJECT_PATH, "tests") +sys.path.append(TESTS_PATH) diff --git a/tests/e2e/expected_download.py b/tests/e2e/expected_download.py index b4b7bdae..c7bbf069 100644 --- a/tests/e2e/expected_download.py +++ b/tests/e2e/expected_download.py @@ -19,9 +19,13 @@ class ExpectedDownload: """ for relative_path, expected_md5_hash in self.expected_md5_file_hashes.items(): full_path = Path(relative_directory) / relative_path - assert os.path.isfile(full_path), f"Expected {str(relative_path)} to be a file but it is not" + assert os.path.isfile( + full_path + ), f"Expected {str(relative_path)} to be a file but it is not" with open(full_path, "rb") as file: md5_hash = hashlib.md5(file.read()).hexdigest() - assert md5_hash == expected_md5_hash, f"MD5 hash for {str(relative_path)} does not match" + assert ( + md5_hash == expected_md5_hash + ), f"MD5 hash for {str(relative_path)} does not match" diff --git a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py index fa1ee45e..4b9c949f 100644 --- a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py +++ b/tests/e2e/youtube/test_channel_as_kodi_tv_show.py @@ -2,10 +2,11 @@ import tempfile from pathlib import Path import pytest -from config.config_file import ConfigFile -from config.subscription import SubscriptionValidator from e2e.expected_download import ExpectedDownload +from ytdl_sub.config.config_file import ConfigFile +from ytdl_sub.config.subscription import SubscriptionValidator + @pytest.fixture() def output_directory(): @@ -55,7 +56,7 @@ def full_channel_subscription(config, subscription_name, subscription_dict): @pytest.fixture def expected_full_channel_download(): - # turn of black formatter here for readability + # turn off black formatter here for readability # fmt: off return ExpectedDownload( expected_md5_file_hashes={ @@ -121,6 +122,13 @@ def expected_full_channel_download(): class TestChannelAsKodiTvShow: - def test_full_channel_download(self, full_channel_subscription, expected_full_channel_download, output_directory): + """ + Downloads my old minecraft youtube channel. Ensure the above files exist and have the + expected md5 file hashes. + """ + + def test_full_channel_download( + self, full_channel_subscription, expected_full_channel_download, output_directory + ): full_channel_subscription.download() expected_full_channel_download.assert_files_exist(relative_directory=output_directory)