From fbe01fb1f00f9b5656e01da5fa8a10c119dc6fa9 Mon Sep 17 00:00:00 2001 From: Taka Date: Tue, 5 May 2020 13:24:27 +0000 Subject: [PATCH] Fixed some tests that were broken when run against the Docker container. --- vasl_templates/webapp/tests/remote.py | 8 ++++---- vasl_templates/webapp/vasl_mod.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/vasl_templates/webapp/tests/remote.py b/vasl_templates/webapp/tests/remote.py index 63db5f2..22d08f4 100644 --- a/vasl_templates/webapp/tests/remote.py +++ b/vasl_templates/webapp/tests/remote.py @@ -27,7 +27,7 @@ from vasl_templates.webapp import vasl_mod as vasl_mod_module _logger = logging.getLogger( "control_tests" ) -_ORIG_CHAPTER_H_NOTES_DIR = app.config.get( "CHAPTER_H_NOTES_DIR" ) +_ORIG_CHAPTER_H_NOTES_DIR = app.config.get( "CHAPTER_H_NOTES_DIR", os.environ.get("CHAPTER_H_NOTES_DIR") ) # --------------------------------------------------------------------- @@ -163,7 +163,7 @@ class ControlTests: app.config[ "VASL_EXTNS_DIR" ] = dname else: _logger.info( "Disabling VASL extensions." ) - app.config.pop( "VASL_EXTNS_DIR", None ) + app.config[ "VASL_EXTNS_DIR" ] = None # configure the VASL module if vmod: @@ -176,7 +176,7 @@ class ControlTests: assert vmod in vmod_fnames app.config[ "VASL_MOD" ] = vmod else: - app.config.pop( "VASL_MOD", None ) + app.config[ "VASL_MOD" ] = None _logger.info( "Installing VASL module: %s", vmod ) # install the new VASL module @@ -213,7 +213,7 @@ class ControlTests: app.config[ "_VASL_EXTN_INFO_DIR_" ] = dname else: _logger.info( "Using the default VASL extension info directory." ) - app.config.pop( "_VASL_EXTN_INFO_DIR_", None ) + app.config[ "_VASL_EXTN_INFO_DIR_" ] = None return self def _get_vassal_engines( self ): diff --git a/vasl_templates/webapp/vasl_mod.py b/vasl_templates/webapp/vasl_mod.py index 540c1fd..0f9d93b 100644 --- a/vasl_templates/webapp/vasl_mod.py +++ b/vasl_templates/webapp/vasl_mod.py @@ -65,9 +65,8 @@ def _load_vasl_extns( extn_dir, msg_store ): #pylint: disable=too-many-locals,to # load our extension info files all_extn_info = {} - if "_VASL_EXTN_INFO_DIR_" in app.config: - dname = app.config["_VASL_EXTN_INFO_DIR_"] # nb: for the test suite - else: + dname = app.config.get( "_VASL_EXTN_INFO_DIR_" ) # nb: this is set by the test suite + if not dname: dname = os.path.join( DATA_DIR, "extensions" ) for fname in glob.glob( os.path.join(dname,"*.json") ): _logger.debug( "Loading VASL extension info: %s", fname )