Fixing/debugging code for tests.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
import asyncio
|
||||
import unittest.mock
|
||||
|
||||
import pytest # type: ignore [import]
|
||||
import pytest
|
||||
|
||||
from playlist.data import settings # type: ignore [import]
|
||||
from playlist.plex import server # type: ignore [import]
|
||||
from playlist.data import settings
|
||||
from playlist.plex import server
|
||||
|
||||
|
||||
def test_calc_delay(mocker): # type: ignore [no-untyped-def]
|
||||
@@ -15,8 +15,8 @@ def test_calc_delay(mocker): # type: ignore [no-untyped-def]
|
||||
mock_s = mock_settings.modify.return_value.__enter__.return_value
|
||||
mock_const.MAX_PROCESSES = 1
|
||||
|
||||
times = [100, 100, 100]
|
||||
weights = [100, 100, 100]
|
||||
times: list[float] = [100, 100, 100]
|
||||
weights: list[float] = [1, 1, 1]
|
||||
|
||||
server.calc_delay(times, weights)
|
||||
|
||||
@@ -63,8 +63,8 @@ async def test_gen_tracks(mocker): # type: ignore [no-untyped-def]
|
||||
assert mock_calc_duration.called
|
||||
|
||||
|
||||
@pytest.mark.asyncio # type: ignore [misc]
|
||||
async def test_total_track_count(mocker: pytest.fixture) -> None:
|
||||
@pytest.mark.asyncio
|
||||
async def test_total_track_count(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test the total_track_count coroutine."""
|
||||
mock_plexapi_server = mocker.patch("playlist.plex.server.plexapi.server")
|
||||
mock_server = mock_plexapi_server.PlexServer.return_value
|
||||
@@ -76,7 +76,7 @@ async def test_total_track_count(mocker: pytest.fixture) -> None:
|
||||
assert result == 1
|
||||
|
||||
|
||||
def test_get_creds(mocker: pytest.fixture) -> None:
|
||||
def test_get_creds(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test the get_creds function."""
|
||||
mock_plexapi_myplex = mocker.patch("playlist.plex.server.plexapi.myplex")
|
||||
mock_input = mocker.patch("builtins.input")
|
||||
@@ -98,8 +98,8 @@ def test_get_creds(mocker: pytest.fixture) -> None:
|
||||
assert mock_getpass.getpass.called
|
||||
|
||||
|
||||
@pytest.mark.asyncio # type: ignore [misc]
|
||||
async def test_downloader(mocker: pytest.fixture) -> None:
|
||||
@pytest.mark.asyncio
|
||||
async def test_downloader(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test the _downloader coroutine."""
|
||||
|
||||
async def fake_run_in_executor(*args): # type: ignore
|
||||
@@ -117,7 +117,7 @@ async def test_downloader(mocker: pytest.fixture) -> None:
|
||||
assert process_time >= 0.1
|
||||
|
||||
|
||||
def test_get_track_batch(mocker: pytest.fixture) -> None:
|
||||
def test_get_track_batch(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test _get_track_batch function."""
|
||||
mock_plexapi_server = mocker.patch("playlist.plex.server.plexapi.server")
|
||||
mock_server = mock_plexapi_server.PlexServer.return_value
|
||||
@@ -132,7 +132,7 @@ def test_get_track_batch(mocker: pytest.fixture) -> None:
|
||||
assert mock_track_dump.called
|
||||
|
||||
|
||||
def test_track_dump(mocker: pytest.fixture) -> None:
|
||||
def test_track_dump(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test the _track_dump function."""
|
||||
mock_track = unittest.mock.MagicMock()
|
||||
mock_track.configure_mock(
|
||||
@@ -156,8 +156,8 @@ def test_track_dump(mocker: pytest.fixture) -> None:
|
||||
assert isinstance(result, dict)
|
||||
|
||||
|
||||
@pytest.mark.asyncio # type: ignore [misc]
|
||||
async def test_gen_batch_params(mocker: pytest.fixture) -> None:
|
||||
@pytest.mark.asyncio
|
||||
async def test_gen_batch_params(mocker): # type: ignore [no-untyped-def]
|
||||
"""Test the _gen_batch_params asynchronous generator."""
|
||||
mock_total_track_count = mocker.patch(
|
||||
"playlist.plex.server.total_track_count",
|
||||
|
||||
Reference in New Issue
Block a user