Updated the dependencies.

master
Pacman Ghost 11 months ago
parent 4df0f5cf77
commit 127c5d46e0
  1. 2
      .pylintrc
  2. 13
      conftest.py
  3. 14
      requirements-dev.txt
  4. 8
      requirements.txt
  5. 2
      vasl_templates/webapp/static/help/index.html
  6. 83
      vasl_templates/webapp/templates/index.html
  7. 2
      vasl_templates/webapp/tests/control_tests.py
  8. 2
      vasl_templates/webapp/tests/control_tests_servicer.py
  9. 1610
      vasl_templates/webapp/tests/proto/generated/control_tests_pb2.py
  10. 2
      vasl_templates/webapp/tests/proto/set_data_dir_request.py
  11. 2
      vasl_templates/webapp/tests/proto/set_default_template_pack_request.py
  12. 2
      vasl_templates/webapp/tests/proto/set_vasl_version_request.py
  13. 2
      vasl_templates/webapp/tests/proto/set_veh_ord_notes_dir_request.py
  14. 5
      vasl_templates/webapp/tests/test_scenario_search.py
  15. 3
      vasl_templates/webapp/tests/test_vassal.py
  16. 7
      vasl_templates/webapp/tests/utils.py

@ -480,4 +480,4 @@ known-third-party=enchant
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception

@ -10,8 +10,6 @@ import urllib.request
from urllib.error import URLError
import pytest
from flask import url_for
from vasl_templates.webapp import app
from vasl_templates.webapp.tests import utils
from vasl_templates.webapp.tests.control_tests import ControlTests
@ -19,6 +17,7 @@ from vasl_templates.webapp.tests.control_tests import ControlTests
FLASK_WEBAPP_PORT = 5011
_pytest_options = None
_orig_url_for = app.url_for
# ---------------------------------------------------------------------
@ -129,7 +128,9 @@ def _make_webapp():
# NOTE: It's not a bad idea to bypass the clipboard, even when running in a browser,
# to avoid problems if something else uses the clipboard while the tests are running.
kwargs["store_clipboard"] = 1
url = url_for( endpoint, _external=True, **kwargs )
if kwargs.get( "_external" ) is None:
kwargs["_external"] = True
url = _orig_url_for( endpoint, **kwargs )
url = url.replace( "http://localhost", app.base_url )
return url
app.url_for = make_webapp_url
@ -219,12 +220,14 @@ def webdriver( request ):
log_fname = os.path.join( tempfile.gettempdir(), "webdriver-pytest.log" )
if driver == "firefox":
options = wb.FirefoxOptions()
options.headless = _pytest_options.headless
if _pytest_options.headless:
options.add_argument( "--headless" )
service = wb.firefox.service.Service( log_path=log_fname )
driver = wb.Firefox( options=options, service=service )
elif driver == "chrome":
options = wb.ChromeOptions()
options.headless = _pytest_options.headless
if _pytest_options.headless:
options.add_argument( "--headless" )
options.add_argument( "--disable-gpu" )
driver = wb.Chrome( options=options )
else:

@ -1,7 +1,7 @@
pytest==7.1.2
grpcio-tools==1.46.3
tabulate==0.8.9
lxml==4.9.0
pylint==2.14.1
pytest-pylint==0.18.0
pyinstaller==5.1
pytest==7.2.2
grpcio-tools==1.53.0
tabulate==0.9.0
lxml==4.9.2
pylint==2.17.2
pytest-pylint==0.19.0
pyinstaller==5.9.0

@ -1,9 +1,9 @@
# python 3.10.7
# python 3.10.10
flask==2.1.2
flask==2.2.3
pyyaml==6.0
pillow==9.1.1
selenium==4.2.0
pillow==9.5.0
selenium==4.8.3
waitress==2.1.2
appdirs==1.4.4
click==8.1.3

@ -73,7 +73,7 @@ If you have Docker installed, the webapp can be run in a container e.g.
<p> You can also run the program directly from the source code. Get a copy from <a href="https://code.pacman-ghost.com/public/vasl-templates">here</a> in the usual way, by <tt>git clone</tt>'ing it, or downloading a ZIP and unpacking it somewhere.
<p> The web server was written and tested using Python 3.10.7, but it doesn't do anything particularly funky, so any recent version of Python <em>should</em> work.
<p> The web server was written and tested using Python 3.10.10, but it doesn't do anything particularly funky, so any recent version of Python <em>should</em> work.
<p> While not essential, it is <em>strongly</em> recommended that you set up a <a href="https://virtualenv.pypa.io/en/stable/">virtual environment</a> first. Then <tt>cd</tt> into the project's root directory, and install the requirements (note the trailing period):
<div class="code">

@ -141,34 +141,66 @@
<script src="{{url_for('static',filename='trumbowyg/plugins/table/trumbowyg.table.min.js')}}"></script>
<script src="{{url_for('static',filename='DOMPurify/purify.min.js')}}"></script>
<script src="{{url_for('static',filename='utils.js')}}"></script>
<script>
function removeUrlTestParams( url )
{
// remove any URL parameters
// NOTE: We can't use URL.searchParams since we might be passed a relative URL.
// FUDGE! The test suite is giving us absolute, encoded URL's :-/
url = strReplaceAll( url, "&amp;", "&" ) ;
var match = url.match( new RegExp( "^http://.+?:\\d+?/" ) ) ;
if ( match )
url = url.substring( match[0].length - 1 ) ;
var pos = url.indexOf( "?" ) ;
if ( pos >= 0 ) {
params = url.substring( pos+1 ).split( "&" ) ;
url = url.substring( 0, pos ) ;
var nKeeps = 0 ;
params.forEach( function( param ) {
var keep = true ;
[ "store_msgs", "disable_close_window_check", "store_clipboard" ].forEach( function( key ) {
if ( param.substring( 0, key.length+1 ) === key + "=" )
keep = false ;
} ) ;
if ( keep ) {
url += ( nKeeps === 0 ) ? "?" : "&" ;
url += param ;
nKeeps += 1 ;
}
} ) ;
}
return url ;
}
gAppName = "{{APP_NAME}}" ;
gAppVersion = "{{APP_VERSION}}" ;
gImagesBaseUrl = "{{url_for('static',filename='images')}}" ;
gAppConfigUrl = "{{url_for('get_app_config')}}" ;
gGetStartupMsgsUrl = "{{url_for('get_startup_msgs')}}" ;
gGetTemplatePackUrl = "{{url_for('get_template_pack')}}" ;
gGetAslRulebook2VoNoteTargetsUrl = "{{url_for('get_asl_rulebook2_vo_note_targets')}}" ;
gShowAslRulebook2VoNoteUrl = "{{url_for('show_asl_rulebook2_target',target='TARGET')}}" ;
gGetDefaultScenarioUrl = "{{url_for('get_default_scenario')}}" ;
gVehicleListingsUrl = "{{url_for('get_vehicle_listings',merge_common=1)}}" ;
gOrdnanceListingsUrl = "{{url_for('get_ordnance_listings',merge_common=1)}}" ;
gVehicleNotesUrl = "{{url_for('get_vehicle_notes')}}" ;
gOrdnanceNotesUrl = "{{url_for('get_ordnance_notes')}}" ;
gGetVaslPieceInfoUrl = "{{url_for('get_vasl_piece_info')}}" ;
gGetOnlineCounterImagesUrl = "{{url_for('get_online_counter_images')}}" ;
gGetScenarioIndexUrl = "{{url_for('get_scenario_index')}}" ;
gGetScenarioUrl = "{{url_for('get_scenario',scenario_id='ID')}}" ;
gGetScenarioCardUrl = "{{url_for('get_scenario_card',scenario_id='ID')}}" ;
gGetRoarScenarioIndexUrl = "{{url_for('get_roar_scenario_index')}}" ;
gAnalyzeVsavUrl = "{{url_for('analyze_vsav')}}" ;
gAnalyzeVlogsUrl = "{{url_for('analyze_vlogs')}}" ;
gUpdateVsavUrl = "{{url_for('update_vsav')}}" ;
gPrepareAsaUploadUrl = "{{url_for('prepare_asa_upload')}}" ;
gOnSuccessfulAsaUploadUrl = "{{url_for('on_successful_asa_upload',scenario_id='ID')}}" ;
gMakeSnippetImageUrl = "{{url_for('make_snippet_image')}}" ;
gGetProgramInfoUrl = "{{url_for('get_program_info')}}" ;
gHelpUrl = "{{url_for('show_help')}}" ;
gImagesBaseUrl = removeUrlTestParams( "{{url_for('static',filename='images')}}" ) ;
gAppConfigUrl = removeUrlTestParams( "{{url_for('get_app_config')}}" ) ;
gGetStartupMsgsUrl = removeUrlTestParams( "{{url_for('get_startup_msgs')}}" ) ;
gGetTemplatePackUrl = removeUrlTestParams( "{{url_for('get_template_pack')}}" ) ;
gGetAslRulebook2VoNoteTargetsUrl = removeUrlTestParams( "{{url_for('get_asl_rulebook2_vo_note_targets')}}" ) ;
gShowAslRulebook2VoNoteUrl = removeUrlTestParams( "{{url_for('show_asl_rulebook2_target',target='TARGET')}}" ) ;
gGetDefaultScenarioUrl = removeUrlTestParams( "{{url_for('get_default_scenario')}}" ) ;
gVehicleListingsUrl = removeUrlTestParams( "{{url_for('get_vehicle_listings',merge_common=1)}}" ) ;
gOrdnanceListingsUrl = removeUrlTestParams( "{{url_for('get_ordnance_listings',merge_common=1)}}" ) ;
gVehicleNotesUrl = removeUrlTestParams( "{{url_for('get_vehicle_notes')}}" ) ;
gOrdnanceNotesUrl = removeUrlTestParams( "{{url_for('get_ordnance_notes')}}" ) ;
gGetVaslPieceInfoUrl = removeUrlTestParams( "{{url_for('get_vasl_piece_info')}}" ) ;
gGetOnlineCounterImagesUrl = removeUrlTestParams( "{{url_for('get_online_counter_images')}}" ) ;
gGetScenarioIndexUrl = removeUrlTestParams( "{{url_for('get_scenario_index')}}" ) ;
gGetScenarioUrl = removeUrlTestParams( "{{url_for('get_scenario',scenario_id='ID')}}" ) ;
gGetScenarioCardUrl = removeUrlTestParams( "{{url_for('get_scenario_card',scenario_id='ID')}}" ) ;
gGetRoarScenarioIndexUrl = removeUrlTestParams( "{{url_for('get_roar_scenario_index')}}" ) ;
gAnalyzeVsavUrl = removeUrlTestParams( "{{url_for('analyze_vsav')}}" ) ;
gAnalyzeVlogsUrl = removeUrlTestParams( "{{url_for('analyze_vlogs')}}" ) ;
gUpdateVsavUrl = removeUrlTestParams( "{{url_for('update_vsav')}}" ) ;
gPrepareAsaUploadUrl = removeUrlTestParams( "{{url_for('prepare_asa_upload')}}" ) ;
gOnSuccessfulAsaUploadUrl = removeUrlTestParams( "{{url_for('on_successful_asa_upload',scenario_id='ID')}}" ) ;
gMakeSnippetImageUrl = removeUrlTestParams( "{{url_for('make_snippet_image')}}" ) ;
gGetProgramInfoUrl = removeUrlTestParams( "{{url_for('get_program_info')}}" ) ;
gHelpUrl = removeUrlTestParams( "{{url_for('show_help')}}" ) ;
</script>
<script src="{{url_for('static',filename='main.js')}}"></script>
@ -190,7 +222,6 @@ gHelpUrl = "{{url_for('show_help')}}" ;
<script src="{{url_for('static',filename='user_settings.js')}}"></script>
<script src="{{url_for('static',filename='html-editor.js')}}"></script>
<script src="{{url_for('static',filename='jQueryHandlers.js')}}"></script>
<script src="{{url_for('static',filename='utils.js')}}"></script>
<script src="{{url_for('static',filename='timer.js')}}"></script>
{%include "testing.html"%}

@ -9,6 +9,7 @@ from google.protobuf.empty_pb2 import Empty #pylint: disable=no-name-in-module
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2_grpc import ControlTestsStub
from vasl_templates.webapp.tests.proto.utils import enum_from_string
#pylint: disable=no-name-in-module
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import \
SetVassalVersionRequest, SetVaslVersionRequest, SetVaslExtnInfoDirRequest, SetGpidRemappingsRequest, \
SetDataDirRequest, SetDefaultScenarioRequest, SetDefaultTemplatePackRequest, \
@ -17,6 +18,7 @@ from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import \
DumpVsavRequest, GetVaslPiecesRequest, \
SetAppConfigValRequest, DeleteAppConfigValRequest, \
SaveTempFileRequest
#pylint: enable=no-name-in-module
# ---------------------------------------------------------------------

@ -28,6 +28,7 @@ from vasl_templates.webapp import \
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2_grpc \
import ControlTestsServicer as BaseControlTestsServicer
#pylint: disable=no-name-in-module
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import \
SetVassalVersionRequest, SetVaslVersionRequest, SetVaslExtnInfoDirRequest, SetGpidRemappingsRequest, \
SetDataDirRequest, SetDefaultScenarioRequest, SetDefaultTemplatePackRequest, \
@ -39,6 +40,7 @@ from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import \
GetVassalVersionsResponse, GetVaslVersionsResponse, GetVaslExtnsResponse, GetVaslModWarningsResponse, \
GetLastSnippetImageResponse, GetLastAsaUploadResponse, \
DumpVsavResponse, GetVaslPiecesResponse, GetAppConfigResponse
#pylint: enable=no-name-in-module
# nb: these are defined as a convenience
_VaslExtnsTypes_NONE = SetVaslVersionRequest.VaslExtnsType.NONE #pylint: disable=no-member

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
""" Injected functions for SetDataDirRequest. """
from .generated.control_tests_pb2 import SetDataDirRequest
from .generated.control_tests_pb2 import SetDataDirRequest #pylint: disable=no-name-in-module
from .utils import enum_to_string
# ---------------------------------------------------------------------

@ -1,6 +1,6 @@
""" Injected functions for SetDefaultTemplatePackRequest. """
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetDefaultTemplatePackRequest
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetDefaultTemplatePackRequest #pylint: disable=no-name-in-module
from .utils import enum_to_string
# ---------------------------------------------------------------------

@ -1,6 +1,6 @@
""" Injected functions for SetVaslVersionRequest. """
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetVaslVersionRequest
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetVaslVersionRequest #pylint: disable=no-name-in-module
from .utils import enum_to_string
# ---------------------------------------------------------------------

@ -1,6 +1,6 @@
""" Injected functions for SetVehOrdNotesDirRequest. """
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetVehOrdNotesDirRequest
from vasl_templates.webapp.tests.proto.generated.control_tests_pb2 import SetVehOrdNotesDirRequest #pylint: disable=no-name-in-module
from .utils import enum_to_string
# ---------------------------------------------------------------------

@ -15,7 +15,8 @@ from vasl_templates.webapp.tests.test_vassal import run_vassal_tests
from vasl_templates.webapp.tests.utils import init_webapp, select_tab, new_scenario, \
set_player, set_template_params, set_scenario_date, get_player_nat, get_theater, set_theater, \
get_turn_track_nturns, \
wait_for, wait_for_elem, find_child, find_children, get_css_classes, set_stored_msg, click_dialog_button
wait_for, wait_for_elem, find_child, find_children, get_css_classes, set_stored_msg, click_dialog_button, \
remove_url_params
# ---------------------------------------------------------------------
@ -833,7 +834,7 @@ def _unload_scenario_card(): #pylint: disable=too-many-branches,too-many-locals
# unload the icons
icons = set(
c.get_attribute( "src" )
remove_url_params( c.get_attribute( "src" ) )
for c in find_children( ".info .icons img", card )
)
if icons:

@ -5,7 +5,6 @@ import re
import json
import base64
import random
import typing.re #pylint: disable=import-error
from vasl_templates.webapp.vassal import VassalShim
from vasl_templates.webapp.utils import TempFile, change_extn, compare_version_strings
@ -963,7 +962,7 @@ def _check_vsav_dump( vsav_dump, expected, ignore=None ):
# compare what we extracted from the dump with what's expected
for snippet_id in expected:
if isinstance( expected[snippet_id], typing.re.Pattern ):
if isinstance( expected[snippet_id], re.Pattern ):
rc = expected[snippet_id].search( labels[snippet_id] ) is not None
else:
assert isinstance( expected[snippet_id], str )

@ -749,6 +749,13 @@ def get_css_classes( elem ):
classes = elem.get_attribute( "class" )
return classes.split() if classes else []
def remove_url_params( url ):
"""Remove parameters from a URL."""
pos = url.find( "?" )
if pos < 0:
return url
return url[:pos]
# ---------------------------------------------------------------------
def get_all_loggers():

Loading…
Cancel
Save