-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
163 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import unittest | ||
|
||
from os.path import abspath, dirname, join | ||
import xml.etree.ElementTree as ET | ||
|
||
from kodi_addon_checker.addons.Repository import Repository | ||
from kodi_addon_checker.check_dependencies import check_circular_dependencies | ||
from kodi_addon_checker.common import load_plugins | ||
from kodi_addon_checker.record import Record | ||
from kodi_addon_checker.reporter import ReportManager | ||
from kodi_addon_checker.report import Report | ||
|
||
HERE = abspath(dirname(__file__)) | ||
|
||
|
||
class TestCheckDependencies(unittest.TestCase): | ||
"""Test dependency checks | ||
""" | ||
|
||
def setUp(self): | ||
"""Test setup | ||
""" | ||
load_plugins() | ||
ReportManager.enable(["array"]) | ||
self.report = Report("") | ||
self.branch = 'krypton' | ||
self.path = join(HERE, 'test_data', 'Circular_depend') | ||
|
||
def test_check_circular_dependency(self): | ||
"""Test circular dependency check | ||
""" | ||
addon_xml = join(self.path, "addon.xml") | ||
addons_xml = join(self.path, "addons.xml") | ||
|
||
parsed_xml = ET.parse(addon_xml).getroot() | ||
all_repo_addons = {self.branch: Repository(self.branch, addons_xml, local_xml=True)} | ||
|
||
check_circular_dependencies(self.report, all_repo_addons, parsed_xml, self.branch) | ||
|
||
records = [Record.__str__(r) for r in ReportManager.getEnabledReporters()[0].reports] | ||
output = [record for record in records if record.startswith("ERROR: Circular")] | ||
expected = ["ERROR: Circular dependencies: plugin.test.one"] | ||
|
||
self.assertListEqual(expected, output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<addon id="plugin.test.two" version="0.0.1" name="Testing" provider-name="Tester"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.25.0"/> | ||
<import addon="plugin.test.one"/> | ||
</requires> | ||
<extension point="xbmc.python.pluginsource" library="addon.py"> | ||
<provides>video</provides> | ||
</extension> | ||
<extension point="xbmc.addon.metadata"> | ||
<summary lang="en_GB">Testing</summary> | ||
<description lang="en_GB">Testing</description> | ||
<language>en</language> | ||
<disclaimer>This is just a test</disclaimer> | ||
<platform>all</platform> | ||
<license>GPL-3.0-only</license> | ||
<assets> | ||
<icon>icon.png</icon> | ||
<fanart>fanart.jpg</fanart> | ||
</assets> | ||
<news>Testing 123</news> | ||
</extension> | ||
</addon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<addons> | ||
<addon id="plugin.test.one" version="0.0.1" name="Testing" provider-name="Tester"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.25.0"/> | ||
<import addon="plugin.test.two"/> | ||
</requires> | ||
<extension point="xbmc.python.pluginsource" library="addon.py"> | ||
<provides>video</provides> | ||
</extension> | ||
<extension point="xbmc.addon.metadata"> | ||
<summary lang="en_GB">Testing</summary> | ||
<description lang="en_GB">Testing</description> | ||
<language>en</language> | ||
<disclaimer>This is just a test</disclaimer> | ||
<platform>all</platform> | ||
<license>GPL-3.0-only</license> | ||
<assets> | ||
<icon>icon.png</icon> | ||
<fanart>fanart.jpg</fanart> | ||
</assets> | ||
<news>Testing 123</news> | ||
</extension> | ||
</addon> | ||
</addons> |