do not set appharness env twice, already done in AppHarnessProd

This commit is contained in:
Benedikt Bartscher 2024-11-05 22:34:59 +01:00
parent d32604713c
commit 4116ab9f66
No known key found for this signature in database

View File

@ -3,7 +3,7 @@
import os import os
import re import re
from pathlib import Path from pathlib import Path
from typing import Generator, Type from typing import Type
import pytest import pytest
@ -81,18 +81,14 @@ def pytest_exception_interact(node, call, report):
) )
def app_harness_env( def app_harness_env(
request: pytest.FixtureRequest, request: pytest.FixtureRequest,
) -> Generator[Type[AppHarness], None, None]: ) -> Type[AppHarness]:
"""Parametrize the AppHarness class to use for the test, either dev or prod. """Parametrize the AppHarness class to use for the test, either dev or prod.
Args: Args:
request: The pytest fixture request object. request: The pytest fixture request object.
Yields: Returns:
The AppHarness class to use for the test. The AppHarness class to use for the test.
""" """
harness: Type[AppHarness] = request.param harness: Type[AppHarness] = request.param
if issubclass(harness, AppHarnessProd): return harness
EnvironmentVariables.REFLEX_ENV_MODE.set(reflex.constants.Env.PROD)
yield harness
if issubclass(harness, AppHarnessProd):
EnvironmentVariables.REFLEX_ENV_MODE.set(None)