Fix tests

This commit is contained in:
Odd Stråbø 2021-10-11 09:15:27 +02:00
parent 53c887d354
commit 390c1d5de8
4 changed files with 9 additions and 7 deletions

View file

@ -4,9 +4,10 @@ from __future__ import division, absolute_import, print_function, unicode_litera
################################################################################################## ##################################################################################################
from six import iteritems from six import iteritems
from kodi_six import xbmc, xbmcgui from kodi_six import xbmcgui
from ..helper import LazyLogger from ..helper import LazyLogger
from ..helper.utils import kodi_version
################################################################################################## ##################################################################################################
@ -30,7 +31,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2]) self.kodi_version = kodi_version()
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
def set_args(self, **kwargs): def set_args(self, **kwargs):

View file

@ -3,8 +3,6 @@ from __future__ import division, absolute_import, print_function, unicode_litera
################################################################################################# #################################################################################################
from kodi_six import xbmc, xbmcvfs
from ..helper import LazyLogger from ..helper import LazyLogger
from ..jellyfin import Jellyfin from ..jellyfin import Jellyfin

View file

@ -15,7 +15,7 @@ from .. import client
from ..database import reset, get_sync, Database, jellyfin_db, get_credentials from ..database import reset, get_sync, Database, jellyfin_db, get_credentials
from ..objects import Objects, Actions from ..objects import Objects, Actions
from ..helper import translate, event, settings, window, dialog, api, JSONRPC, LazyLogger from ..helper import translate, event, settings, window, dialog, api, JSONRPC, LazyLogger
from ..helper.utils import JsonDebugPrinter, translate_path from ..helper.utils import JsonDebugPrinter, translate_path, kodi_version
from ..jellyfin import Jellyfin from ..jellyfin import Jellyfin
################################################################################################# #################################################################################################
@ -874,7 +874,7 @@ def backup():
from ..helper.utils import delete_folder, copytree from ..helper.utils import delete_folder, copytree
path = settings('backupPath') path = settings('backupPath')
folder_name = "Kodi%s.%s" % (xbmc.getInfoLabel('System.BuildVersion')[:2], xbmc.getInfoLabel('System.Date(dd-mm-yy)')) folder_name = "Kodi%s.%s" % (kodi_version(), xbmc.getInfoLabel('System.Date(dd-mm-yy)'))
folder_name = dialog("input", heading=translate(33089), defaultt=folder_name) folder_name = dialog("input", heading=translate(33089), defaultt=folder_name)
if not folder_name: if not folder_name:

View file

@ -34,7 +34,10 @@ def addon_id():
def kodi_version(): def kodi_version():
return int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0]) # Kodistubs returns empty string, causing Python 3 tests to choke on int()
# TODO: Make Kodistubs version configurable for testing purposes
version_string = xbmc.getInfoLabel('System.BuildVersion') or "19.1 (19.1.0) Git:20210509-85e05228b4"
return int(version_string.split(' ', 1)[0].split('.', 1)[0])
def window(key, value=None, clear=False, window_id=10000): def window(key, value=None, clear=False, window_id=10000):