Move test/ to tests/ (#17)
This PR includes: - Migrate test/ to tests/ - Remove codecov (use the organization's default)
This commit is contained in:
parent
6e9a4718fe
commit
fa90644f61
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -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
|
||||
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -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
|
||||
continue-on-error: true
|
||||
|
14
.gitignore
vendored
14
.gitignore
vendored
@ -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
|
||||
|
11
Makefile
11
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
|
||||
|
12
codecov.yml
12
codecov.yml
@ -1,12 +0,0 @@
|
||||
coverage:
|
||||
range: 50..100
|
||||
round: nearest
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: 75%
|
||||
threshold: 6%
|
||||
patch: false
|
||||
comment: false
|
||||
ignore:
|
||||
- "test"
|
@ -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')
|
||||
|
@ -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
|
@ -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):
|
@ -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]
|
Loading…
Reference in New Issue
Block a user