diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index ae64f4e04..f9390bf42 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -102,12 +102,3 @@ jobs: with: name: skills-module-test-results path: tests/skills-module-test-results.xml - - - name: Test Resource Resolution - run: | - pytest test/test_res.py --doctest-modules --junitxml=tests/resource-resolution-test-results.xml - - name: Upload Resource Resolution test results - uses: actions/upload-artifact@v2 - with: - name: resource-resolution-test-results - path: tests/resource-resolution-test-results.xml \ No newline at end of file diff --git a/neon_core/__init__.py b/neon_core/__init__.py index c8e3f2be4..bf6d37be3 100644 --- a/neon_core/__init__.py +++ b/neon_core/__init__.py @@ -26,22 +26,6 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# import sys - -from neon_core.config import setup_resolve_resource_file, get_core_version -from os.path import dirname - - -# TODO: Deprecate below -NEON_ROOT_PATH = dirname(__file__) -# sys.path.append(NEON_ROOT_PATH) - -CORE_VERSION_STR = "" # get_core_version() -setup_resolve_resource_file() - -__all__ = ['NEON_ROOT_PATH', - 'CORE_VERSION_STR'] - # TODO: Patching for ovos-core 0.0.7 import ovos_utils.messagebus diff --git a/neon_core/config.py b/neon_core/config.py deleted file mode 100644 index 28e0d1c16..000000000 --- a/neon_core/config.py +++ /dev/null @@ -1,76 +0,0 @@ -# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework -# All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. -# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, -# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo -# BSD-3 License -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from this -# software without specific prior written permission. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -def get_core_version() -> str: - """ - Get the core version string. - NOTE: `init_config` should be called before this method - """ - # TODO: Remove by 2024 - from ovos_utils.log import log_deprecation - log_deprecation("This method is deprecated; use Python built-in utilities " - "to find package versions", "23.12.1") - # patch version string to allow downstream to know where it is running - try: - import mycroft.version - core_version_str = '.'.join(map(str, - mycroft.version.CORE_VERSION_TUPLE)) + \ - "(NeonGecko)" - mycroft.version.CORE_VERSION_STR = core_version_str - except (ImportError, AttributeError): - return "" - return core_version_str - - -def setup_resolve_resource_file(): - """ - Override default resolve_resource_file to include resources in neon-core. - Priority: neon-utils, neon-core, ~/.local/share/neon, ~/.neon, mycroft-core - """ - from ovos_utils.log import log_deprecation - from neon_utils.file_utils import resolve_neon_resource_file - try: - from mycroft.util.file_utils import resolve_resource_file - except (ImportError, AttributeError): - resolve_resource_file = None - - def patched_resolve_resource_file(res_name): - log_deprecation("This method is deprecated; use " - "`ovos_utils.file_utils.resolve_resource_file.", - "23.12.1") - resource = resolve_neon_resource_file(res_name) or \ - resolve_resource_file(res_name) - return resource - - try: - import mycroft.util - mycroft.util.file_utils.resolve_resource_file = \ - patched_resolve_resource_file - except (ImportError, AttributeError): - pass diff --git a/test/test_res.py b/test/test_res.py deleted file mode 100644 index 92c159def..000000000 --- a/test/test_res.py +++ /dev/null @@ -1,76 +0,0 @@ -# NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework -# All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. -# Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, -# Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo -# BSD-3 License -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from this -# software without specific prior written permission. -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os -import sys -import unittest - -from os.path import join, isfile, dirname - -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - - -class ResourceTests(unittest.TestCase): - def test_resolve_resource_file(self): - from ovos_utils.file_utils import resolve_resource_file - import neon_core - root_path = join(dirname(neon_core.__file__), 'res') - config = {'data_dir': root_path} - for file in ("hey-neon.pb", "hey-neon.pb.params"): - self.assertTrue(isfile(resolve_resource_file(join("precise_models", - file), - config=config))) - for file in ("acknowledge.mp3", "beep.wav", "loaded.wav", - "start_listening.wav"): - self.assertTrue(isfile(resolve_resource_file(join("snd", - file), - config=config))) - for file in ("neon_logo.png", "SYSTEM_AnimatedImageFrame.qml", - "SYSTEM_HtmlFrame.qml", "SYSTEM_TextFrame.qml", - "SYSTEM_UrlFrame.qml", "WebViewHtmlFrame.qml", - "WebViewUrlFrame.qml"): - self.assertTrue(isfile(resolve_resource_file(join("ui", - file), - config=config))) - for file in ("cancel.voc", "i didn't catch that.dialog", - "neon.voc", "no.voc", "not.loaded.dialog", - "not connected to the internet.dialog", - "phonetic_spellings.txt", "skill.error.dialog", - "skills updated.dialog", "yes.voc"): - self.assertTrue(isfile(resolve_resource_file(join("text", "en-us", - file), - config=config))) - - for lang in ("en-au", "en-us", "en-uk", "uk-ua", "ru-ru"): - self.assertTrue(isfile(resolve_resource_file(join("text", lang, - "neon.voc"), - config=config))) - - -if __name__ == '__main__': - unittest.main()