diff --git a/docker/requirements.txt b/docker/requirements.txt index 828850e..e058e11 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -1,7 +1,6 @@ -requests -aiohttp -asyncio -python-dateutil -verboselogs -pytest -pytest-asyncio +requests==2.31.0 +asyncio==3.4.3 +python-dateutil==2.8.2 +verboselogs==1.7 +pytest==8.0.1 +pytest-asyncio==0.23.5 diff --git a/src/remove_slow.py b/src/remove_slow.py index a328ed6..1fbcad0 100644 --- a/src/remove_slow.py +++ b/src/remove_slow.py @@ -7,8 +7,8 @@ async def remove_slow(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloads, # Detects slow downloads and triggers delete. Adds to blocklist try: failType = 'slow' - logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue)) queue = await get_queue(BASE_URL, API_KEY) + logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue)) if not queue: return 0 # Find items affected affectedItems = [] diff --git a/src/remove_stalled.py b/src/remove_stalled.py index 0a1bf13..bf70e38 100644 --- a/src/remove_stalled.py +++ b/src/remove_stalled.py @@ -7,8 +7,8 @@ async def remove_stalled(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloa # Detects stalled and triggers repeat check and subsequent delete. Adds to blocklist try: failType = 'stalled' - logger.debug('remove_stalled/queue IN: %s', formattedQueueInfo(queue)) queue = await get_queue(BASE_URL, API_KEY) + logger.debug('remove_stalled/queue IN: %s', formattedQueueInfo(queue)) if not queue: return 0 # Find items affected affectedItems = [] diff --git a/src/remove_unmonitored.py b/src/remove_unmonitored.py index 0192c4a..e406951 100644 --- a/src/remove_unmonitored.py +++ b/src/remove_unmonitored.py @@ -8,8 +8,8 @@ async def remove_unmonitored(settings_dict, BASE_URL, API_KEY, NAME, deleted_dow # Removes downloads belonging to movies/tv shows that are not monitored. Does not add to blocklist try: failType = 'unmonitored' - logger.debug('remove_unmonitored/queue IN: %s', formattedQueueInfo(queue)) queue = await get_queue(BASE_URL, API_KEY) + logger.debug('remove_unmonitored/queue IN: %s', formattedQueueInfo(queue)) if not queue: return 0 # Find items affected monitoredDownloadIDs = [] diff --git a/tests/test_nest_functions.py b/tests/test_nest_functions.py index 5f184ed..fe7866f 100644 --- a/tests/test_nest_functions.py +++ b/tests/test_nest_functions.py @@ -1,7 +1,7 @@ -# pytest tests - +# python3 -m pytest import pytest from src.utils.nest_functions import nested_set, add_keys_nested_dict, nested_get + # import asyncio # Dictionary that is modified / queried as part of tests @@ -11,7 +11,6 @@ # @pytest.mark.asyncio # async def test_nested_set(): -@pytest def test_nested_set(): expected_output = { 1: {'name': 'Breaking Bad 1', 'data': {'episodes': 3, 'year': 1991, 'actors': ['Peter', 'Paul', 'Ppacey']}}, 2: {'name': 'Breaking Bad 2', 'data': {'episodes': 6, 'year': 1994, 'actors': ['Weter', 'Waul', 'Wpacey']}}, @@ -21,7 +20,6 @@ def test_nested_set(): nested_set(output, [2, 'data' ,'year'], 1994) assert expected_output == output -@pytest def test_nested_set_conditions(): input = { 1: [{'year': 2001, 'rating': 'high'}, {'year': 2002, 'rating': 'high'}, {'year': 2003, 'rating': 'high'}], 2: [{'year': 2001, 'rating': 'high'}, {'year': 2002, 'rating': 'high'}, {'year': 2003, 'rating': 'high'}]} @@ -31,7 +29,6 @@ def test_nested_set_conditions(): nested_set(output, [2, 'rating'], 'LOW', {'year': 2003}) assert expected_output == output -@pytest def test_nested_set_conditions_multiple(): input = { 1: [{'rating': 'high', 'color': 1, 'stack': 1}, {'rating': 'high', 'color': 2, 'stack': 2}, {'rating': 'high', 'color': 2, 'stack': 1}]} expected_output = { 1: [{'rating': 'high', 'color': 1, 'stack': 1}, {'rating': 'high', 'color': 2, 'stack': 2}, {'rating': 'LOW', 'color': 2, 'stack': 1}]} @@ -39,7 +36,6 @@ def test_nested_set_conditions_multiple(): nested_set(output, [1, 'rating'], 'LOW', {'color': 2, 'stack': 1}) assert expected_output == output -@pytest def test_add_keys_nested_dict(): expected_output = { 1: {'name': 'Breaking Bad 1', 'data': {'episodes': 3, 'year': 1991, 'actors': ['Peter', 'Paul', 'Ppacey']}}, 2: {'name': 'Breaking Bad 2', 'data': {'episodes': 6, 'year': 1994, 'actors': ['Weter', 'Waul', 'Wpacey'], 'spaceship': True}}, @@ -49,7 +45,6 @@ def test_add_keys_nested_dict(): assert expected_output == output -@pytest def test_nested_get(): input = { 1: [{'name': 'A', 'color': 1, 'stack': 1}, {'name': 'B', 'color': 2, 'stack': 2}, {'name': 'C', 'color': 2, 'stack': 1}]} expected_output = ['C']