Example tests for services! General cleanup.
(cherry picked from commit 9f41bb4)
This commit is contained in:
@@ -42,13 +42,15 @@ class SettingsProvider(object):
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
if not os.path.exists(self.BASE_PATH):
|
||||
os.mkdir(self.BASE_PATH)
|
||||
if hasattr(self, 'BASE_PATH'):
|
||||
if not os.path.exists(self.BASE_PATH):
|
||||
os.mkdir(self.BASE_PATH)
|
||||
|
||||
def getSettings(self, area, defaults=None):
|
||||
|
||||
s = self.settings.get(area)
|
||||
if s is None:
|
||||
|
||||
if s is None and hasattr(self, 'BASE_PATH'):
|
||||
p = os.path.join(self.BASE_PATH, area)
|
||||
|
||||
if not os.path.exists(p):
|
||||
@@ -72,6 +74,8 @@ class SettingsProvider(object):
|
||||
info[item] = defaults[item]
|
||||
|
||||
self.settings[area] = s = Settings(p, info)
|
||||
else:
|
||||
s = None
|
||||
|
||||
return s
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from service.attribute import Attribute
|
||||
|
||||
def test_attribute():
|
||||
"""
|
||||
We don't really have much to test here, to throw a generic attribute at it and validate we get the expected results
|
||||
We don't really have much to test here, so throw a generic attribute at it and validate we get the expected results
|
||||
|
||||
:return:
|
||||
"""
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
||||
"""import tests."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
# import importlib
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
# import pytest
|
||||
|
||||
'''
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# Add root to python paths, this allows us to import submodules
|
||||
sys.path.append(os.path.realpath(os.path.join(script_dir, '..')))
|
||||
|
||||
# noinspection PyPep8
|
||||
import service
|
||||
# noinspection PyPep8
|
||||
import gui
|
||||
# noinspection PyPep8
|
||||
import eos
|
||||
# noinspection PyPep8
|
||||
import utils
|
||||
|
||||
|
||||
def test_packages():
|
||||
assert service
|
||||
assert gui
|
||||
assert eos
|
||||
assert utils
|
||||
|
||||
|
||||
def service_modules():
|
||||
for root, folders, files in os.walk("service"):
|
||||
for file_ in files:
|
||||
if file_.endswith(".py") and not file_.startswith("_"):
|
||||
mod_name = "{}.{}".format(
|
||||
root.replace("/", "."),
|
||||
file_.split(".py")[0],
|
||||
)
|
||||
yield mod_name
|
||||
|
||||
|
||||
def eos_modules():
|
||||
for root, folders, files in os.walk("eos"):
|
||||
for file_ in files:
|
||||
if file_.endswith(".py") and not file_.startswith("_"):
|
||||
mod_name = "{}.{}".format(
|
||||
root.replace("/", "."),
|
||||
file_.split(".py")[0],
|
||||
)
|
||||
yield mod_name
|
||||
|
||||
'''
|
||||
|
||||
# TODO: Disable walk through Eos paths until eos.types is killed. eos.types causes the import to break
|
||||
'''
|
||||
@pytest.mark.parametrize("mod_name", eos_modules())
|
||||
def test_eos_imports(mod_name):
|
||||
assert importlib.import_module(mod_name)
|
||||
'''
|
||||
Reference in New Issue
Block a user