Merge branch 'feature/FixTests' into dev

This commit is contained in:
JackDandy 2023-05-04 23:33:32 +01:00
commit bb9d47026a
6 changed files with 59 additions and 41 deletions

View file

@ -15,7 +15,7 @@ jobs:
matrix: matrix:
os: os:
- windows-latest - windows-latest
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] python-version: ['3.8', '3.9', '3.10', '3.11']
steps: steps:
- name: 'Set up Python ${{ matrix.python-version }}' - name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -34,7 +34,7 @@ jobs:
matrix: matrix:
os: os:
- ubuntu-latest - ubuntu-latest
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] python-version: ['3.8', '3.9', '3.10', '3.11']
steps: steps:
- name: 'Set up Python ${{ matrix.python-version }}' - name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -55,7 +55,7 @@ jobs:
matrix: matrix:
os: os:
- macos-latest - macos-latest
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] python-version: ['3.8', '3.9', '3.10', '3.11']
steps: steps:
- name: 'Set up Python ${{ matrix.python-version }}' - name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v4 uses: actions/setup-python@v4

View file

@ -22,6 +22,14 @@
* Add menu Shows/"TMDB Cards" * Add menu Shows/"TMDB Cards"
* Add a persons available socials (Youtube, LinkedIn, Reddit, Fansite, TikTok, Wikidata) * Add a persons available socials (Youtube, LinkedIn, Reddit, Fansite, TikTok, Wikidata)
* Change use TVDb genres on view-show if config/General/Interface/"Enable IMDb info" is disabled * Change use TVDb genres on view-show if config/General/Interface/"Enable IMDb info" is disabled
* Change remove Python 3.7 from CI
[develop changelog]
* Fix tv test to init recently added ReleaseMap to scene_exceptions refactor
* Fix double use of var `result` overwrites the return value and causes an error in _parse_custom_exceptions
* Fix name_parser_tests and webapi_tests
### 3.28.0 (2023-04-12 13:05:00 UTC) ### 3.28.0 (2023-04-12 13:05:00 UTC)

View file

@ -362,11 +362,9 @@ class ReleaseMap(Job):
else: else:
used.add((cur_for_season, cur_for_episode)) used.add((cur_for_season, cur_for_episode))
if not sn or sn != (target_season, cur_target_episode): # not already set if not sn or sn != (target_season, cur_target_episode): # not already set
result = set_scene_numbering_helper( count_updated_numbers += int(bool(set_scene_numbering_helper(
tvid, prodid, for_season=cur_for_season, for_episode=cur_for_episode, tvid, prodid, for_season=cur_for_season, for_episode=cur_for_episode,
scene_season=target_season, scene_episode=cur_target_episode) scene_season=target_season, scene_episode=cur_target_episode).get('success')))
if result.get('success'):
count_updated_numbers += 1
cur_for_episode += 1 cur_for_episode += 1

View file

@ -11,6 +11,7 @@ import sickgear
from sickgear import db, name_cache, tv from sickgear import db, name_cache, tv
from sickgear.classes import OrderedDefaultdict from sickgear.classes import OrderedDefaultdict
from sickgear.name_parser import parser from sickgear.name_parser import parser
from sickgear.scene_exceptions import ReleaseMap
sickgear.SYS_ENCODING = 'UTF-8' sickgear.SYS_ENCODING = 'UTF-8'
@ -474,6 +475,7 @@ scene_numbering_test = [
class MultiSceneNumbering(test.SickbeardTestDBCase): class MultiSceneNumbering(test.SickbeardTestDBCase):
def test_multi_ep_numbering(self): def test_multi_ep_numbering(self):
_ = ReleaseMap()
for e_t in scene_numbering_test: for e_t in scene_numbering_test:
sickgear.showList = [] sickgear.showList = []
sickgear.showDict = {} sickgear.showDict = {}

View file

@ -18,18 +18,18 @@
import unittest import unittest
import test_lib as test import test_lib as test
from random import randint from random import randint
import datetime import datetime
import copy import copy
import sickgear import sickgear
from sickgear.tv import TVEpisode, TVShow, TVidProdid, prodid_bitshift from sickgear.tv import TVEpisode, TVShow, TVidProdid, prodid_bitshift
from exceptions_helper import ex, MultipleShowObjectsException from exceptions_helper import MultipleShowObjectsException
from sickgear.helpers import find_show_by_id from sickgear.helpers import find_show_by_id
from sickgear import indexermapper from sickgear import indexermapper
from sickgear.indexers.indexer_api import TVInfoAPI from sickgear.indexers.indexer_api import TVInfoAPI
from sickgear.indexers.indexer_config import TVINFO_IMDB, TVINFO_TMDB, TVINFO_TRAKT, TVINFO_TVDB, TVINFO_TVMAZE, \ from sickgear.indexers.indexer_config import TVINFO_IMDB, TVINFO_TMDB, TVINFO_TVDB, TVINFO_TVMAZE, TVINFO_TVRAGE
TVINFO_TVRAGE from sickgear.scene_exceptions import ReleaseMap
# noinspection PyUnreachableCode # noinspection PyUnreachableCode
if False: if False:
@ -42,6 +42,7 @@ class TVShowTests(test.SickbeardTestDBCase):
super(TVShowTests, self).setUp() super(TVShowTests, self).setUp()
sickgear.showList = [] sickgear.showList = []
sickgear.showDict = {} sickgear.showDict = {}
_ = ReleaseMap()
def test_init_indexerid(self): def test_init_indexerid(self):
show_obj = TVShow(1, 1, 'en') show_obj = TVShow(1, 1, 'en')
@ -81,6 +82,7 @@ class TVEpisodeTests(test.SickbeardTestDBCase):
super(TVEpisodeTests, self).setUp() super(TVEpisodeTests, self).setUp()
sickgear.showList = [] sickgear.showList = []
sickgear.showDict = {} sickgear.showDict = {}
_ = ReleaseMap()
def test_init_empty_db(self): def test_init_empty_db(self):
show_obj = TVShow(1, 1, 'en') show_obj = TVShow(1, 1, 'en')
@ -200,36 +202,36 @@ shows = [{'tvid': TVINFO_TVDB, 'prodid': 123,
] ]
find_tests = [ find_tests = [
{'para': {'show_id': {TVINFO_TVMAZE: 22, TVINFO_TVRAGE: 785}, 'no_mapped_ids': False}, {'para': {'show_id': {TVINFO_TVMAZE: 22, TVINFO_TVRAGE: 785}, 'no_mapped_ids': False},
'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'search via mapped id'}, 'description': 'search via mapped id'},
{'para': {'show_id': {TVINFO_TVDB: 123}}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, {'para': {'show_id': {TVINFO_TVDB: 123}}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'simple standard search via main id dict'}, 'description': 'simple standard search via main id dict'},
{'para': {'show_id': {TVINFO_TVDB: 12345}}, 'result': None, {'para': {'show_id': {TVINFO_TVDB: 12345}}, 'result': None,
'description': 'simple standard search via main id dict, for non-existing show'}, 'description': 'simple standard search via main id dict, for non-existing show'},
{'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVMAZE: 123}, 'check_multishow': True}, {'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVMAZE: 123}, 'check_multishow': True},
'result': {'success': False}, 'result': {'success': False},
'description': 'search via 2 ids matching multiple shows and multi show check'}, 'description': 'search via 2 ids matching multiple shows and multi show check'},
{'para': {'show_id': {TVINFO_TVDB: 5555, TVINFO_TVMAZE: 123}, 'check_multishow': True}, {'para': {'show_id': {TVINFO_TVDB: 5555, TVINFO_TVMAZE: 123}, 'check_multishow': True},
'result': {'tvid': TVINFO_TVMAZE, 'prodid': 123}, 'result': {'tvid': TVINFO_TVMAZE, 'prodid': 123},
'description': 'search via 2 ids matching only 1 show and multi show check'}, 'description': 'search via 2 ids matching only 1 show and multi show check'},
{'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVMAZE: 123}}, {'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVMAZE: 123}},
'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'search via 2 ids matching only 1 show without multi show check #1'}, 'description': 'search via 2 ids matching only 1 show without multi show check #1'},
{'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVRAGE: 22}}, {'para': {'show_id': {TVINFO_TVDB: 123, TVINFO_TVRAGE: 22}},
'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'search via 2 ids matching only 1 show without multi show check #2'}, 'description': 'search via 2 ids matching only 1 show without multi show check #2'},
{'para': {'show_id': {TVINFO_TVMAZE: 22, TVINFO_TVRAGE: 785}}, {'para': {'show_id': {TVINFO_TVMAZE: 22, TVINFO_TVRAGE: 785}},
'result': None, 'result': None,
'description': 'search for 2 non-existing ids without mapping'}, 'description': 'search for 2 non-existing ids without mapping'},
{'para': {'show_id': {TVINFO_IMDB: 123}}, {'para': {'show_id': {TVINFO_IMDB: 123}},
'result': None, 'description': 'invalid sid search (tvid above tvid_bitmask)'}, 'result': None, 'description': 'invalid sid search (tvid above tvid_bitmask)'},
{'para': {'show_id': '%s:123' % TVINFO_TVDB}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, {'para': {'show_id': '%s:123' % TVINFO_TVDB}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'simple search via tvid_prodid string'}, 'description': 'simple search via tvid_prodid string'},
{'para': {'show_id': '%s:123' % TVINFO_TVDB, 'check_multishow': True}, {'para': {'show_id': '%s:123' % TVINFO_TVDB, 'check_multishow': True},
'result': {'tvid': TVINFO_TVDB, 'prodid': 123}, 'result': {'tvid': TVINFO_TVDB, 'prodid': 123},
'description': 'simple search via tvid_prodid string and check multishow'}, 'description': 'simple search via tvid_prodid string and check multishow'},
] ]
class TVFindTests(test.SickbeardTestDBCase): class TVFindTests(test.SickbeardTestDBCase):

View file

@ -106,6 +106,10 @@ def fake_action(*args, **kwargs):
pass pass
class fake_class():
pass
class WebAPICase(test.SickbeardTestDBCase): class WebAPICase(test.SickbeardTestDBCase):
webserver = None webserver = None
instance = None instance = None
@ -147,6 +151,10 @@ class WebAPICase(test.SickbeardTestDBCase):
sickgear.started = True sickgear.started = True
sickgear.API_KEYS = [['unit test key', '1234567890']] sickgear.API_KEYS = [['unit test key', '1234567890']]
sickgear.USE_API = True sickgear.USE_API = True
sickgear.process_media_scheduler = fake_class()
sickgear.update_show_scheduler = fake_class()
sickgear.process_media_scheduler.is_running_job = False
sickgear.update_show_scheduler.is_running_job = False
except (BaseException, Exception) as e: except (BaseException, Exception) as e:
print('Failed to start WebServer: %s' % ex(e)) print('Failed to start WebServer: %s' % ex(e))