From 364e20d40d72a2ed0b7012a13ed7c15dc32cb4af Mon Sep 17 00:00:00 2001 From: Parthib Roy Date: Sun, 24 Nov 2024 22:56:12 -0800 Subject: [PATCH] test new --- .github/workflows/stubs.yml | 20 +++++++++++++++++++- tests/python/CMakeLists.txt | 9 +++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stubs.yml b/.github/workflows/stubs.yml index aae642bbc..6696cf7e3 100644 --- a/.github/workflows/stubs.yml +++ b/.github/workflows/stubs.yml @@ -39,6 +39,23 @@ jobs: run: | .github/workflows/dependencies/gcc-openmpi.sh python3 -m pip install -U pybind11-stubgen + python3 -m pip install seleniumbase pytest + + # Added: Install Firefox and geckodriver + - name: Install Browser Dependencies + run: | + sudo apt-get update + sudo apt-get install -y firefox-esr xvfb + wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz + tar -xzf geckodriver-v0.33.0-linux64.tar.gz + sudo mv geckodriver /usr/local/bin/ + sudo chmod +x /usr/local/bin/geckodriver + + # Added: Start virtual display + - name: Start Virtual Display + run: | + Xvfb :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo "DISPLAY=:99" >> $GITHUB_ENV - name: Set Up Cache uses: actions/cache@v4 @@ -81,7 +98,8 @@ jobs: - name: Unit tests run: | - mpiexec -np 1 python3 -m pytest tests/python/ + export DISPLAY=:99 + mpiexec -np 1 python3 -m pytest -v tests/python/ - uses: stefanzweifel/git-auto-commit-action@v5 name: Commit Updated Stub Files diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 9be50f672..fb54bc92c 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -10,6 +10,9 @@ file(MAKE_DIRECTORY ${pytest_rundir}) file(COPY ${ImpactX_SOURCE_DIR}/examples DESTINATION ${pytest_rundir}) +file(COPY ${ImpactX_SOURCE_DIR}/src/python/impactx/dashboard +DESTINATION ${pytest_rundir}) + # run add_test(NAME ${pytest_name} COMMAND ${Python_EXECUTABLE} -m pytest -s -vvvv @@ -22,3 +25,9 @@ set_property(TEST ${pytest_name} APPEND PROPERTY ENVIRONMENT "OMP_NUM_THREADS=2" # set PYTHONPATH and PATH (for .dll files) impactx_test_set_pythonpath(${pytest_name}) + +# Add environment variables needed for dashboard tests +set_property(TEST ${pytest_name} APPEND PROPERTY ENVIRONMENT + "DISPLAY=:99" + "PYTHONPATH=${pytest_rundir}:$ENV{PYTHONPATH}" +)