Don't parse config file for tests

This commit is contained in:
shortcutme 2019-04-15 22:18:40 +02:00
parent 1d4ab8833b
commit 0c0f117bc3
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -38,12 +38,13 @@ else:
CHROMEDRIVER_PATH = "chromedriver" CHROMEDRIVER_PATH = "chromedriver"
SITE_URL = "http://127.0.0.1:43110" SITE_URL = "http://127.0.0.1:43110"
TEST_DATA_PATH = 'src/Test/testdata'
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/../lib")) # External modules directory sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/../lib")) # External modules directory
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/..")) # Imports relative to src dir sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/..")) # Imports relative to src dir
from Config import config from Config import config
config.argv = ["none"] # Dont pass any argv to config parser config.argv = ["none"] # Dont pass any argv to config parser
config.parse(silent=True) # Plugins need to access the configuration config.parse(silent=True, parse_config=False) # Plugins need to access the configuration
config.action = "test" config.action = "test"
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
@ -73,7 +74,6 @@ fmt = logging.Formatter(fmt='+%(relative)ss %(levelname)-8s %(name)s %(message)s
# Load plugins # Load plugins
from Plugin import PluginManager from Plugin import PluginManager
TEST_DATA_PATH = 'src/Test/testdata'
config.data_dir = TEST_DATA_PATH # Use test data for unittests config.data_dir = TEST_DATA_PATH # Use test data for unittests
os.chdir(os.path.abspath(os.path.dirname(__file__) + "/../..")) # Set working dir os.chdir(os.path.abspath(os.path.dirname(__file__) + "/../..")) # Set working dir
@ -82,7 +82,7 @@ all_loaded = PluginManager.plugin_manager.loadPlugins()
assert all_loaded, "There was error loading plugins" assert all_loaded, "There was error loading plugins"
config.loadPlugins() config.loadPlugins()
config.parse() # Parse again to add plugin configuration options config.parse(parse_config=False) # Parse again to add plugin configuration options
config.action = "test" config.action = "test"
config.debug_socket = True # Use test data for unittests config.debug_socket = True # Use test data for unittests