diff --git a/.gitattributes b/.gitattributes index 405dfb6..2d5d90c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,8 @@ .github/ export-ignore -test/ export-ignore -.coverage export-ignore +tests/ export-ignore .gitattributes export-ignore .gitignore export-ignore .pylintrc export-ignore -codecov.yml export-ignore Makefile export-ignore requirements.txt export-ignore tox.ini export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66bfeaf..949c6cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest env: PYTHONIOENCODING: utf-8 - PYTHONPATH: ${{ github.workspace }}/resources/lib:${{ github.workspace }}/test + PYTHONPATH: ${{ github.workspace }}/resources/lib:${{ github.workspace }}/tests strategy: fail-fast: false matrix: @@ -49,10 +49,10 @@ jobs: coverage run -m unittest discover - name: Run addon run: | - coverage run -a test/run.py / + coverage run -a tests/run.py / - name: Run add-on service run: | coverage run -a service_entry.py - name: Upload code coverage to CodeCov uses: codecov/codecov-action@v1 - continue-on-error: true \ No newline at end of file + continue-on-error: true diff --git a/.gitignore b/.gitignore index 61373b7..65923aa 100644 --- a/.gitignore +++ b/.gitignore @@ -12,10 +12,10 @@ Thumbs.db .coverage .tox/ -test/userdata/credentials.json -test/userdata/temp -test/userdata/token.json -test/userdata/cache -test/userdata/addon_data -test/userdata/tokens -test/cdm +tests/userdata/credentials.json +tests/userdata/temp +tests/userdata/token.json +tests/userdata/cache +tests/userdata/addon_data +tests/userdata/tokens +tests/cdm diff --git a/Makefile b/Makefile index 6b8f0e5..296d1ff 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -export PYTHONPATH := $(CURDIR):$(CURDIR)/test +export PYTHONPATH := $(CURDIR):$(CURDIR)/tests PYTHON := python # Collect information to build as sensible package name @@ -13,8 +13,6 @@ exclude_files = \*.new \*.orig \*.pyc \*.pyo languages = $(filter-out en_gb, $(patsubst resources/language/resource.language.%, %, $(wildcard resources/language/*))) -.PHONY: check test - all: check test build zip: build @@ -22,7 +20,7 @@ check: check-pylint check-tox check-translations check-pylint: @echo ">>> Running pylint checks" - @$(PYTHON) -m pylint *.py resources/lib/ test/ + @$(PYTHON) -m pylint *.py resources/lib/ tests/ check-tox: @echo ">>> Running tox checks" @@ -48,10 +46,9 @@ test-unit: @$(PYTHON) -m unittest discover -v -b -f clean: - @find . -name '*.pyc' -type f -delete - @find . -name '*.pyo' -type f -delete + @find . -name '*.py[cod]' -type f -delete @find . -name '__pycache__' -type d -delete - @rm -rf .pytest_cache/ .tox/ test/cdm test/userdata/temp + @rm -rf .pytest_cache/ .tox/ tests/cdm tests/userdata/temp @rm -f *.log .coverage build: clean diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 584cc4c..0000000 --- a/codecov.yml +++ /dev/null @@ -1,12 +0,0 @@ -coverage: - range: 50..100 - round: nearest - status: - project: - default: - target: 75% - threshold: 6% - patch: false -comment: false -ignore: -- "test" diff --git a/resources/lib/viervijfzes/auth.py b/resources/lib/viervijfzes/auth.py index 76a61fc..61365a1 100644 --- a/resources/lib/viervijfzes/auth.py +++ b/resources/lib/viervijfzes/auth.py @@ -8,6 +8,7 @@ import logging import os import time +from resources.lib import kodiutils from resources.lib.viervijfzes.auth_awsidp import AwsIdp, InvalidLoginException, AuthenticationException _LOGGER = logging.getLogger('auth-api') diff --git a/test/__init__.py b/tests/__init__.py similarity index 100% rename from test/__init__.py rename to tests/__init__.py diff --git a/test/run.py b/tests/run.py similarity index 100% rename from test/run.py rename to tests/run.py diff --git a/test/test_api.py b/tests/test_api.py similarity index 100% rename from test/test_api.py rename to tests/test_api.py diff --git a/test/test_auth.py b/tests/test_auth.py similarity index 100% rename from test/test_auth.py rename to tests/test_auth.py diff --git a/test/test_epg.py b/tests/test_epg.py similarity index 100% rename from test/test_epg.py rename to tests/test_epg.py diff --git a/test/test_routing.py b/tests/test_routing.py similarity index 100% rename from test/test_routing.py rename to tests/test_routing.py diff --git a/test/test_search.py b/tests/test_search.py similarity index 100% rename from test/test_search.py rename to tests/test_search.py diff --git a/test/userdata/addon_settings.json b/tests/userdata/addon_settings.json similarity index 100% rename from test/userdata/addon_settings.json rename to tests/userdata/addon_settings.json diff --git a/test/userdata/credentials.json.example b/tests/userdata/credentials.json.example similarity index 100% rename from test/userdata/credentials.json.example rename to tests/userdata/credentials.json.example diff --git a/test/userdata/global_settings.json b/tests/userdata/global_settings.json similarity index 100% rename from test/userdata/global_settings.json rename to tests/userdata/global_settings.json diff --git a/test/xbmc.py b/tests/xbmc.py similarity index 98% rename from test/xbmc.py rename to tests/xbmc.py index 1ec7252..88e31d5 100644 --- a/test/xbmc.py +++ b/tests/xbmc.py @@ -237,11 +237,11 @@ def sleep(seconds): def translatePath(path): """ A stub implementation of the xbmc translatePath() function """ if path.startswith('special://home'): - return path.replace('special://home', os.path.join(os.getcwd(), 'test/')) + return path.replace('special://home', os.path.join(os.getcwd(), 'tests/')) if path.startswith('special://masterprofile'): - return path.replace('special://masterprofile', os.path.join(os.getcwd(), 'test/userdata/')) + return path.replace('special://masterprofile', os.path.join(os.getcwd(), 'tests/userdata/')) if path.startswith('special://profile'): - return path.replace('special://profile', os.path.join(os.getcwd(), 'test/userdata/')) + return path.replace('special://profile', os.path.join(os.getcwd(), 'tests/userdata/')) if path.startswith('special://userdata'): - return path.replace('special://userdata', os.path.join(os.getcwd(), 'test/userdata/')) + return path.replace('special://userdata', os.path.join(os.getcwd(), 'tests/userdata/')) return path diff --git a/test/xbmcaddon.py b/tests/xbmcaddon.py similarity index 97% rename from test/xbmcaddon.py rename to tests/xbmcaddon.py index 7890c6a..86ceae9 100644 --- a/test/xbmcaddon.py +++ b/tests/xbmcaddon.py @@ -60,7 +60,7 @@ class Addon: """A stub implementation for the xbmcaddon Addon class setSetting() method""" self.settings[key] = value # NOTE: Disable actual writing as it is no longer needed for testing - # with open('test/userdata/addon_settings.json', 'w') as fd: + # with open('tests/userdata/addon_settings.json', 'w') as fd: # json.dump(filtered_settings, fd, sort_keys=True, indent=4) def setSettingBool(self, key, value): diff --git a/test/xbmcextra.py b/tests/xbmcextra.py similarity index 92% rename from test/xbmcextra.py rename to tests/xbmcextra.py index 1fdad15..d617189 100644 --- a/test/xbmcextra.py +++ b/tests/xbmcextra.py @@ -74,10 +74,10 @@ def global_settings(): """Use the global_settings file""" import json try: - with open('test/userdata/global_settings.json') as f: + with open('tests/userdata/global_settings.json') as f: settings = json.load(f) except OSError as e: - print("Error: Cannot use 'test/userdata/global_settings.json' : %s" % e) + print("Error: Cannot use 'tests/userdata/global_settings.json' : %s" % e) settings = { 'locale.language': 'resource.language.en_gb', 'network.bandwidth': 0, @@ -104,10 +104,10 @@ def addon_settings(addon_id=None): """Use the addon_settings file""" import json try: - with open('test/userdata/addon_settings.json') as f: + with open('tests/userdata/addon_settings.json') as f: settings = json.load(f) except OSError as e: - print("Error: Cannot use 'test/userdata/addon_settings.json' : %s" % e) + print("Error: Cannot use 'tests/userdata/addon_settings.json' : %s" % e) settings = {} # Read credentials from environment or credentials.json @@ -115,13 +115,13 @@ def addon_settings(addon_id=None): # print('Using credentials from the environment variables ADDON_USERNAME and ADDON_PASSWORD') settings[ADDON_ID]['username'] = os.environ.get('ADDON_USERNAME') settings[ADDON_ID]['password'] = os.environ.get('ADDON_PASSWORD') - elif os.path.exists('test/userdata/credentials.json'): - # print('Using credentials from test/userdata/credentials.json') - with open('test/userdata/credentials.json') as f: + elif os.path.exists('tests/userdata/credentials.json'): + # print('Using credentials from tests/userdata/credentials.json') + with open('tests/userdata/credentials.json') as f: credentials = json.load(f) settings[ADDON_ID].update(credentials) else: - print("Error: Cannot use 'test/userdata/credentials.json'") + print("Error: Cannot use 'tests/userdata/credentials.json'") if addon_id: return settings[addon_id] diff --git a/test/xbmcgui.py b/tests/xbmcgui.py similarity index 100% rename from test/xbmcgui.py rename to tests/xbmcgui.py diff --git a/test/xbmcplugin.py b/tests/xbmcplugin.py similarity index 100% rename from test/xbmcplugin.py rename to tests/xbmcplugin.py diff --git a/test/xbmcvfs.py b/tests/xbmcvfs.py similarity index 100% rename from test/xbmcvfs.py rename to tests/xbmcvfs.py