Merge "pytest-based tests fix HEADLESS run setting"

This commit is contained in:
Zuul
2025-07-31 09:49:44 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 6 deletions

View File

@@ -188,8 +188,8 @@ def record_video(request, report_dir, xdisplay):
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def xdisplay(): def xdisplay():
IS_SELENIUM_HEADLESS = os.environ.get('SELENIUM_HEADLESS', False) IS_SELENIUM_HEADLESS = os.environ.get('SELENIUM_HEADLESS', "True")
if IS_SELENIUM_HEADLESS: if IS_SELENIUM_HEADLESS.lower() == "true":
width, height = 1920, 1080 width, height = 1920, 1080
vdisplay = xvfbwrapper.Xvfb(width=width, height=height) vdisplay = xvfbwrapper.Xvfb(width=width, height=height)
args = [] args = []

11
tox.ini
View File

@@ -62,7 +62,7 @@ commands =
[testenv:selenium-headless] [testenv:selenium-headless]
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
SELENIUM_HEADLESS=1 SELENIUM_HEADLESS=True
WITH_SELENIUM=1 WITH_SELENIUM=1
commands = commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
@@ -82,9 +82,10 @@ commands =
passenv = passenv =
DISPLAY DISPLAY
FFMPEG_INSTALLED FFMPEG_INSTALLED
XAUTHORITY
setenv = setenv =
INTEGRATION_TESTS=1 INTEGRATION_TESTS=1
SELENIUM_HEADLESS=False SELENIUM_HEADLESS=True
commands = commands =
oslo-config-generator --namespace openstack_dashboard_integration_tests oslo-config-generator --namespace openstack_dashboard_integration_tests
pytest --ds=openstack_dashboard.test.settings -v -x --junitxml="{toxinidir}/test_reports/integration_test_results.xml" --html="{toxinidir}/test_reports/integration_test_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/integration_tests} pytest --ds=openstack_dashboard.test.settings -v -x --junitxml="{toxinidir}/test_reports/integration_test_results.xml" --html="{toxinidir}/test_reports/integration_test_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/integration_tests}
@@ -94,8 +95,9 @@ commands =
passenv = passenv =
DISPLAY DISPLAY
FFMPEG_INSTALLED FFMPEG_INSTALLED
XAUTHORITY
setenv = setenv =
SELENIUM_HEADLESS=1 SELENIUM_HEADLESS=True
commands = commands =
oslo-config-generator --namespace openstack_dashboard_integration_tests oslo-config-generator --namespace openstack_dashboard_integration_tests
pytest -x -v -k "not federation" --junitxml="{toxinidir}/test_reports/integration_pytest_results.xml" --html="{toxinidir}/test_reports/integration_pytest_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/selenium/integration} pytest -x -v -k "not federation" --junitxml="{toxinidir}/test_reports/integration_pytest_results.xml" --html="{toxinidir}/test_reports/integration_pytest_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/selenium/integration}
@@ -105,8 +107,9 @@ commands =
passenv = passenv =
DISPLAY DISPLAY
FFMPEG_INSTALLED FFMPEG_INSTALLED
XAUTHORITY
setenv = setenv =
SELENIUM_HEADLESS=1 SELENIUM_HEADLESS=True
commands = commands =
oslo-config-generator --namespace openstack_dashboard_integration_tests oslo-config-generator --namespace openstack_dashboard_integration_tests
pytest --ds=openstack_dashboard.settings -v --junitxml="{toxinidir}/test_reports/integration_uitest_results.xml" --html="{toxinidir}/test_reports/integration_uitest_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/selenium/ui} pytest --ds=openstack_dashboard.settings -v --junitxml="{toxinidir}/test_reports/integration_uitest_results.xml" --html="{toxinidir}/test_reports/integration_uitest_results.html" --self-contained-html {posargs:{toxinidir}/openstack_dashboard/test/selenium/ui}