|
|
@ -1,6 +1,7 @@ |
|
|
|
""" Test VASSAL integration. """ |
|
|
|
""" Test VASSAL integration. """ |
|
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
import os |
|
|
|
|
|
|
|
import traceback |
|
|
|
import re |
|
|
|
import re |
|
|
|
import json |
|
|
|
import json |
|
|
|
import base64 |
|
|
|
import base64 |
|
|
@ -877,14 +878,32 @@ def run_vassal_tests( webapp, func, vasl_extns_type=None, |
|
|
|
assert False, "Can't find a valid combination of VASSAL and VASL." |
|
|
|
assert False, "Can't find a valid combination of VASSAL and VASL." |
|
|
|
|
|
|
|
|
|
|
|
# run the test for each VASSAL+VASL |
|
|
|
# run the test for each VASSAL+VASL |
|
|
|
for vassal_version in vassal_versions: |
|
|
|
log_fname = os.environ.get( "RUN_VASSAL_TESTS_LOG" ) # nb: define this to log activity |
|
|
|
for vasl_version in vasl_versions: |
|
|
|
log_file = open( log_fname, "w", encoding="utf-8" ) if log_fname else None #pylint: disable=consider-using-with |
|
|
|
if not VassalShim.is_compatible_version( vassal_version, vasl_version ): |
|
|
|
def log( fmt, *args, **kwargs ): |
|
|
|
continue |
|
|
|
if log_file: |
|
|
|
webapp.control_tests \ |
|
|
|
print( fmt.format( *args, **kwargs ), file=log_file ) |
|
|
|
.set_vassal_version( vassal_version ) \ |
|
|
|
log_file.flush() |
|
|
|
.set_vasl_version( vasl_version, vasl_extns_type ) |
|
|
|
try: |
|
|
|
func() |
|
|
|
for vassal_version in vassal_versions: |
|
|
|
|
|
|
|
for vasl_version in vasl_versions: |
|
|
|
|
|
|
|
if not VassalShim.is_compatible_version( vassal_version, vasl_version ): |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
log( "Running tests for VASSAL {}, VASL {}...", vassal_version, vasl_version ) |
|
|
|
|
|
|
|
webapp.control_tests \ |
|
|
|
|
|
|
|
.set_vassal_version( vassal_version ) \ |
|
|
|
|
|
|
|
.set_vasl_version( vasl_version, vasl_extns_type ) |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
func() |
|
|
|
|
|
|
|
log ( "- OK.\n" ) |
|
|
|
|
|
|
|
except Exception as exc: #pylint: disable=broad-except |
|
|
|
|
|
|
|
log( "- Failed: {}\n{}", exc, |
|
|
|
|
|
|
|
re.sub( "^", " ", traceback.format_exc(), flags=re.MULTILINE ) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
#raise |
|
|
|
|
|
|
|
finally: |
|
|
|
|
|
|
|
if log_file: |
|
|
|
|
|
|
|
log_file.close() |
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------- |
|
|
|
# --------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|