Updated the dependencies.

master
Pacman Ghost 5 months ago
parent 127c5d46e0
commit 2c6f0f2ba3
  1. 14
      Dockerfile
  2. 10
      conftest.py
  3. 1
      docker/config/site.cfg
  4. 10
      requirements-dev.txt
  5. 11
      requirements.txt
  6. 2
      vasl_templates/webapp/scenarios.py
  7. 2
      vasl_templates/webapp/tests/test_vasl_extensions.py
  8. 2
      vasl_templates/webapp/tests/utils.py
  9. 14
      vasl_templates/webapp/webdriver.py

@ -1,28 +1,28 @@
# NOTE: Use the run-container.sh script to build and launch this container.
# NOTE: Multi-stage builds require Docker >= 17.05.
FROM rockylinux:8.5 AS base
FROM rockylinux:9.1 AS base
# update packages and install requirements
RUN dnf -y upgrade-minimal && \
dnf install -y python39
dnf install -y python3.11
# NOTE: We don't need the following stuff for the build step, but it's nice to not have to re-install
# it all every time we change the requirements :-/
# install Java
ARG JAVA_URL=https://download.oracle.com/java/17/archive/jdk-17.0.2_linux-x64_bin.tar.gz
RUN curl -s "$JAVA_URL" | tar -xz -C /usr/bin/
RUN dnf install -y java-17-openjdk
# install Firefox
ARG FIREFOX_URL=https://ftp.mozilla.org/pub/firefox/releases/94.0.2/linux-x86_64/en-US/firefox-94.0.2.tar.bz2
# NOTE: We could install this using dnf, but the version of geckodriver needs to match it.
ARG FIREFOX_URL=https://ftp.mozilla.org/pub/firefox/releases/117.0.1/linux-x86_64/en-US/firefox-117.0.1.tar.bz2
RUN dnf install -y bzip2 xorg-x11-server-Xvfb gtk3 dbus-glib && \
curl -s "$FIREFOX_URL" | tar -jx -C /usr/local/ && \
ln -s /usr/local/firefox/firefox /usr/bin/firefox && \
echo "exclude=firefox" >>/etc/dnf/dnf.conf
# install geckodriver
ARG GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-linux64.tar.gz
ARG GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
RUN curl -sL "$GECKODRIVER_URL" | tar -xz -C /usr/bin/
# clean up
@ -33,7 +33,7 @@ RUN dnf clean all
FROM base AS build
# set up a virtualenv
RUN python3 -m venv /opt/venv
RUN python3.11 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --upgrade pip

@ -1,6 +1,7 @@
""" pytest support functions. """
import os
import shutil
import threading
import json
import re
@ -188,9 +189,9 @@ def _make_webapp():
# we won't have even got this far, since it needs to be there to drive the browser.
# NOTE: This will have no effect if we're talking to a remote server, but we can live with that.
if _pytest_options.webdriver == "firefox":
app.config[ "WEBDRIVER_PATH" ] = "geckodriver"
app.config[ "WEBDRIVER_PATH" ] = shutil.which( "geckodriver" )
elif _pytest_options.webdriver == "chrome":
app.config[ "WEBDRIVER_PATH" ] = "chromedriver"
app.config[ "WEBDRIVER_PATH" ] = shutil.which( "chromedriver" )
return app
@ -217,12 +218,13 @@ def webdriver( request ):
# initialize
driver = request.config.getoption( "--webdriver" )
from selenium import webdriver as wb
log_fname = os.path.join( tempfile.gettempdir(), "webdriver-pytest.log" )
if driver == "firefox":
service = wb.firefox.service.Service(
log_output = os.path.join( tempfile.gettempdir(), "webdriver-pytest.log" )
)
options = wb.FirefoxOptions()
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()

@ -2,5 +2,4 @@
IS_CONTAINER = 1
JAVA_PATH = /usr/bin/jdk-17.0.2/bin/java
WEBDRIVER_PATH = /usr/bin/geckodriver

@ -1,7 +1,7 @@
pytest==7.2.2
grpcio-tools==1.53.0
pytest==7.4.2
grpcio-tools==1.58.0
tabulate==0.9.0
lxml==4.9.2
pylint==2.17.2
lxml==4.9.3
pylint==2.17.5
pytest-pylint==0.19.0
pyinstaller==5.9.0
pyinstaller==5.13.2

@ -1,9 +1,10 @@
# python 3.10.10
# python 3.11.4
flask==2.2.3
pyyaml==6.0
flask==2.3.3
pyyaml==6.0.1
# NOTE: Pillow 9.5.0 is the last version that provides 32-bit wheels.
pillow==9.5.0
selenium==4.8.3
selenium==4.12.0
waitress==2.1.2
appdirs==1.4.4
click==8.1.3
click==8.1.7

@ -539,7 +539,7 @@ def prepare_asa_upload(): #pylint: disable=too-many-locals
max_size = parse_int( app.config.get( "ASA_MAX_SCREENSHOT_SIZE" ), 200 ) * 1024
if len(screenshot_data) > max_size:
ratio = math.sqrt( float(max_size) / len(screenshot_data) )
img = img.resize( ( int(img.width * ratio), int(img.height * ratio) ), Image.ANTIALIAS )
img = img.resize( ( int(img.width * ratio), int(img.height * ratio) ), Image.LANCZOS )
# add a border
border_size = parse_int( app.config.get( "ASA_SCREENSHOT_BORDER_SIZE" ), 5 )
img = ImageOps.expand( img, border_size, (255,255,255,255) )

@ -448,7 +448,7 @@ def _check_warning_msgs( webapp, expected ):
warnings = webapp.control_tests.get_vasl_mod_warnings()
if expected:
assert len(warnings) == 1
if isinstance( expected, typing.re.Pattern ):
if isinstance( expected, typing.Pattern ):
assert expected.search( warnings[0] )
else:
assert warnings[0].startswith( expected )

@ -671,7 +671,7 @@ def wait_for_clipboard( timeout, expected, contains=None, transform=None ):
if transform:
clipboard = transform( clipboard )
if contains is None:
if isinstance( expected, typing.re.Pattern ):
if isinstance( expected, typing.Pattern ):
return expected.search( clipboard ) is not None
else:
return expected == clipboard

@ -61,7 +61,7 @@ class WebDriver:
log_fname = globvars.user_profile.webdriver_log_fname
if "chromedriver" in webdriver_path:
options = webdriver.ChromeOptions()
options.headless = True
options.add_argument( "--headless" )
options.add_argument( "--no-sandbox" ) # nb: need this on the rPi 4
options.add_argument( "--no-proxy-server" )
# OMG! The chromedriver looks for Chrome/Chromium in a hard-coded, fixed location (the default
@ -70,23 +70,23 @@ class WebDriver:
if chrome_path:
options.binary_location = chrome_path
service = webdriver.chrome.service.Service(
webdriver_path, log_path=log_fname
webdriver_path, log_output=log_fname
)
if is_windows():
service.creationflags = 0x8000000 # win32process.CREATE_NO_WINDOW
service.creation_flags = 0x8000000 # win32process.CREATE_NO_WINDOW
self.driver = webdriver.Chrome(
options=options, service=service
)
elif "geckodriver" in webdriver_path:
options = webdriver.FirefoxOptions()
options.headless = True
options.add_argument( "--headless" )
service = webdriver.firefox.service.Service(
webdriver_path, log_path=log_fname
webdriver_path, log_output=log_fname
)
if is_windows():
service.creationflags = 0x8000000 # win32process.CREATE_NO_WINDOW
service.creation_flags = 0x8000000 # win32process.CREATE_NO_WINDOW
self.driver = webdriver.Firefox(
options=options, proxy=None, service=service
options=options, service=service
)
else:
raise SimpleError( "Can't identify webdriver: {}".format( webdriver_path ) )

Loading…
Cancel
Save