From b9ae46c1e937964c5c5641e8603eb6f2e91d9662 Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Thu, 1 Aug 2024 04:17:54 +0000 Subject: [PATCH 1/2] Try removing clear=True --- .github/workflows/app-tests.yaml | 2 +- tests/conftest.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/app-tests.yaml b/.github/workflows/app-tests.yaml index c1c14bd1..922f5943 100755 --- a/.github/workflows/app-tests.yaml +++ b/.github/workflows/app-tests.yaml @@ -76,7 +76,7 @@ jobs: run: python3 -m pytest -s -vv --cov --cov-fail-under=85 - name: Run E2E tests with Playwright id: e2e - if: runner.os != 'Windows' + #if: runner.os != 'Windows' run: | playwright install chromium --with-deps python3 -m pytest tests/e2e.py --tracing=retain-on-failure diff --git a/tests/conftest.py b/tests/conftest.py index 6dffdb5b..efd53434 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,7 +43,7 @@ def monkeypatch_session(): @pytest.fixture(scope="session") def mock_session_env(monkeypatch_session): """Mock the environment variables for testing.""" - with mock.patch.dict(os.environ, clear=True): + with mock.patch.dict(os.environ): # Database monkeypatch_session.setenv("POSTGRES_HOST", POSTGRES_HOST) monkeypatch_session.setenv("POSTGRES_USERNAME", POSTGRES_USERNAME) From 368b548dc54ec6c17203aa7434a03785bb79cd7a Mon Sep 17 00:00:00 2001 From: Pamela Fox Date: Thu, 1 Aug 2024 04:30:17 +0000 Subject: [PATCH 2/2] Delete comment --- .github/workflows/app-tests.yaml | 1 - tests/conftest.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/app-tests.yaml b/.github/workflows/app-tests.yaml index 922f5943..b99cc962 100755 --- a/.github/workflows/app-tests.yaml +++ b/.github/workflows/app-tests.yaml @@ -76,7 +76,6 @@ jobs: run: python3 -m pytest -s -vv --cov --cov-fail-under=85 - name: Run E2E tests with Playwright id: e2e - #if: runner.os != 'Windows' run: | playwright install chromium --with-deps python3 -m pytest tests/e2e.py --tracing=retain-on-failure diff --git a/tests/conftest.py b/tests/conftest.py index efd53434..d53ee24e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,6 +43,9 @@ def monkeypatch_session(): @pytest.fixture(scope="session") def mock_session_env(monkeypatch_session): """Mock the environment variables for testing.""" + # Note that this does *not* clear existing env variables by default- + # we used to specify clear=True but this caused issues with Playwright tests + # https://github.com/microsoft/playwright-python/issues/2506 with mock.patch.dict(os.environ): # Database monkeypatch_session.setenv("POSTGRES_HOST", POSTGRES_HOST)