From 1106aae76ecd3906d0ccbf482b5f945615927019 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Wed, 22 Jan 2025 15:18:35 -0800 Subject: [PATCH] remove integration screenshots (#4677) --- .github/workflows/integration_app_harness.yml | 7 ----- reflex/config.py | 3 -- tests/integration/conftest.py | 30 ------------------- 3 files changed, 40 deletions(-) diff --git a/.github/workflows/integration_app_harness.yml b/.github/workflows/integration_app_harness.yml index 5e88fc412..0bafd3601 100644 --- a/.github/workflows/integration_app_harness.yml +++ b/.github/workflows/integration_app_harness.yml @@ -50,14 +50,7 @@ jobs: - run: poetry run uv pip install pyvirtualdisplay pillow pytest-split pytest-retry - name: Run app harness tests env: - SCREENSHOT_DIR: /tmp/screenshots/${{ matrix.state_manager }}/${{ matrix.python-version }}/${{ matrix.split_index }} REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }} run: | poetry run playwright install chromium poetry run pytest tests/integration --retries 3 --maxfail=5 --splits 2 --group ${{matrix.split_index}} - - uses: actions/upload-artifact@v4 - name: Upload failed test screenshots - if: always() - with: - name: failed_test_screenshots - path: /tmp/screenshots diff --git a/reflex/config.py b/reflex/config.py index 8511694fb..d5eee8dfd 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -556,9 +556,6 @@ class EnvironmentVariables: # Arguments to pass to the app harness driver. APP_HARNESS_DRIVER_ARGS: EnvVar[str] = env_var("") - # Where to save screenshots when tests fail. - SCREENSHOT_DIR: EnvVar[Optional[Path]] = env_var(None) - # Whether to check for outdated package versions. REFLEX_CHECK_LATEST_VERSION: EnvVar[bool] = env_var(True) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index d11344903..67bd26c49 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -1,8 +1,6 @@ """Shared conftest for all integration tests.""" import os -import re -from pathlib import Path import pytest @@ -36,34 +34,6 @@ def xvfb(): yield None -def pytest_exception_interact(node, call, report): - """Take and upload screenshot when tests fail. - - Args: - node: The pytest item that failed. - call: The pytest call describing when/where the test was invoked. - report: The pytest log report object. - """ - screenshot_dir = environment.SCREENSHOT_DIR.get() - if DISPLAY is None or screenshot_dir is None: - return - - screenshot_dir = Path(screenshot_dir) - screenshot_dir.mkdir(parents=True, exist_ok=True) - safe_filename = re.sub( - r"(?u)[^-\w.]", - "_", - str(node.nodeid).strip().replace(" ", "_").replace(":", "_").replace(".py", ""), - ) - - try: - DISPLAY.waitgrab().save( - (Path(screenshot_dir) / safe_filename).with_suffix(".png"), - ) - except Exception as e: - print(f"Failed to take screenshot for {node}: {e}") - - @pytest.fixture( scope="session", params=[AppHarness, AppHarnessProd], ids=["dev", "prod"] )