diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 10666f6..5a05160 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -12,14 +12,24 @@ on: [push] jobs: pytest: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.9", "3.10", "3.11"] + include: + - os: windows-latest + python-version: "3.11" + - os: macos-latest + python-version: "3.11" + steps: - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | diff --git a/tests/test_command_download.py b/tests/test_command_download.py index 43e3ca0..13ea044 100644 --- a/tests/test_command_download.py +++ b/tests/test_command_download.py @@ -10,7 +10,7 @@ @pytest.mark.asyncio -@patch("youtube_bz.commands.download.YouTubeAPI.Client.get_search_results") +@patch("youtube_bz.api.youtube.Client.get_search_results") async def test_get_no_best_match(mock_search_results): # type: ignore yt_initial_data = json.dumps( { @@ -40,7 +40,7 @@ async def test_get_no_best_match(mock_search_results): # type: ignore @pytest.mark.asyncio -@patch("youtube_bz.commands.download.YouTubeAPI.Client.get_search_results") +@patch("youtube_bz.api.youtube.Client.get_search_results") async def test_get_best_match(mock_search_results): # type: ignore yt_initial_data = json.dumps( { @@ -85,7 +85,7 @@ async def test_get_best_match(mock_search_results): # type: ignore @pytest.mark.asyncio -@patch("youtube_bz.commands.download.YouTubeAPI.Client.get_search_results") +@patch("youtube_bz.api.youtube.Client.get_search_results") async def test_fail_get_best_match(mock_search_results): # type: ignore mock_search_results.side_effect = aiohttp.ClientError() artist_credit: ArtistCredit = {"name": "foo"} @@ -100,15 +100,15 @@ async def test_fail_get_best_match(mock_search_results): # type: ignore await get_best_match(release, track) -@patch("youtube_bz.commands.download.pytube.YouTube", autospec=pytube.YouTube) +@patch("pytube.YouTube", autospec=pytube.YouTube) def test_download_video_audio(*_): download_video_audio("AmEN!", "2TjcPpasesA") @pytest.mark.asyncio -@patch("youtube_bz.commands.download.pytube.YouTube", autospec=pytube.YouTube) -@patch("youtube_bz.commands.download.MusicBrainzAPI.Client.lookup_release") -@patch("youtube_bz.commands.download.YouTubeAPI.Client.get_search_results") +@patch("pytube.YouTube", autospec=pytube.YouTube) +@patch("youtube_bz.api.musicbrainz.Client.lookup_release") +@patch("youtube_bz.api.youtube.Client.get_search_results") async def test_download(mock_search_results, mock_lookup_release, *_): # type: ignore yt_initial_data = json.dumps( { diff --git a/youtube_bz/main.py b/youtube_bz/main.py index a7d4815..0b899fd 100644 --- a/youtube_bz/main.py +++ b/youtube_bz/main.py @@ -16,14 +16,13 @@ def print_version() -> None: async def run_command(args: argparse.Namespace): verbose = args.verbose if "verbose" in args else False - match args.command: - case "download": - await commands.download( - args.mbid, - verbose, - ) - case _: - print(f"Unknown command {args.command}") + if args.command == "download": + await commands.download( + args.mbid, + verbose, + ) + else: + print(f"Unknown command {args.command}") def get_command_parser() -> argparse.ArgumentParser: